Form group add show feature in attribute..

This commit is contained in:
Cüneyt Şentürk 2020-03-19 22:57:28 +03:00
parent e947cc9332
commit 3500570b92
12 changed files with 137 additions and 93 deletions

View File

@ -1,106 +1,106 @@
@stack('bulk_action_row_input_start') @stack('bulk_action_row_input_start')
@php @php
if (is_array($path)) { if (is_array($path)) {
$path = route('bulk-actions.action', $path); $path = route('bulk-actions.action', $path);
} else { } else {
$path = url('common/bulk-actions/' . $path); $path = url('common/bulk-actions/' . $path);
}
$actions_to_show = [];
foreach ($actions as $key => $action) {
if ((isset($action['permission']) && !user()->can($action['permission']))) {
continue;
} }
$actions_to_show[$key] = true; $actions_to_show = [];
} foreach ($actions as $key => $action) {
@endphp if ((isset($action['permission']) && !user()->can($action['permission']))) {
continue;
}
@if(!empty($actions_to_show)) $actions_to_show[$key] = true;
<div class="align-items-center d-none" }
v-if="bulk_action.show" @endphp
:class="[{'show': bulk_action.show}]">
<div class="mr-6"> @if(!empty($actions_to_show))
<span class="text-white d-none d-sm-block"> <div class="align-items-center d-none"
<b v-text="bulk_action.count"></b> v-if="bulk_action.show"
<span v-if="bulk_action.count === 1"> :class="[{'show': bulk_action.show}]">
{{ strtolower(trans_choice($text, 1)) }} <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') }}
</span> </span>
<span v-else-if="bulk_action.count > 1"> </div>
{{ strtolower(trans_choice($text, 2)) }}
</span>
{{ trans('bulk_actions.selected') }}
</span>
</div>
<div class="w-25 mr-4" v-if="bulk_action.count"> <div class="w-25 mr-4" v-if="bulk_action.count">
<div class="form-group mb-0"> <div class="form-group mb-0">
<select <select
class="form-control form-control-sm" class="form-control form-control-sm"
v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : 'bulk_action.value' }}" v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : 'bulk_action.value' }}"
@change="onChange"> @change="onChange">
<option value="*">{{ trans_choice('bulk_actions.bulk_actions', 2) }}</option> <option value="*">{{ trans_choice('bulk_actions.bulk_actions', 2) }}</option>
@foreach($actions as $key => $action) @foreach($actions as $key => $action)
@if(isset($actions_to_show[$key])) @if(isset($actions_to_show[$key]))
<option <option
value="{{ $key }}" value="{{ $key }}"
@if(!empty($action['message'])) @if(!empty($action['message']))
data-message="{{ trans_choice($action['message'], 2, ['type' => $text]) }}" data-message="{{ trans_choice($action['message'], 2, ['type' => $text]) }}"
@endif @endif
>{{ trans($action['name']) }}</option> >{{ trans($action['name']) }}</option>
@endif @endif
@endforeach @endforeach
</select> </select>
<input type="hidden" name="bulk_action_path" value="{{ $path }}" /> <input type="hidden" name="bulk_action_path" value="{{ $path }}" />
</div>
</div>
<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>
<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> </div>
</div>
<div class="mr-4" v-if="bulk_action.count"> <akaunting-modal
<button type="button" class="btn btn-sm btn-outline-confirm" :show="bulk_action.modal"
:disabled="bulk_action.value == '*'" :title="'{{ trans_choice($text, 2) }}'"
v-if="bulk_action.message.length" :message="bulk_action.message"
@click="bulk_action.modal=true"> @cancel="onCancel"
<span>{{ trans('general.confirm') }}</span> v-if='bulk_action.message && bulk_action.modal'>
</button> <template #card-footer>
<button type="button" class="btn btn-sm btn-outline-confirm" <div class="float-right">
:disabled="bulk_action.value == '*'" <button type="button" class="btn btn-outline-secondary" @click="onCancel">
v-if="!bulk_action.message.length" <span>{{ trans('general.cancel') }}</span>
@click="onAction"> </button>
<span>{{ trans('general.confirm') }}</span>
</button>
</div>
<div class="mr-4" v-if="bulk_action.count"> <button :disabled="bulk_action.loading" type="button" class="btn btn-success button-submit" @click="onAction">
<button type="button" class="btn btn-outline-clear btn-sm" <div class="aka-loader d-none"></div>
@click="onClear"> <span>{{ trans('general.confirm') }}</span>
<span>{{ trans('general.clear') }}</span> </button>
</button> </div>
</div> </template>
</div> </akaunting-modal>
@else
<akaunting-modal <div class="text-white" :class="[{'show': bulk_action.show}]">{{ trans('bulk_actions.no_action') }}</div>
:show="bulk_action.modal" @endif
:title="'{{ trans_choice($text, 2) }}'"
: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>
<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
<div class="text-white" :class="[{'show': bulk_action.show}]">{{ trans('bulk_actions.no_action') }}</div>
@endif
@stack('bulk_action_row_input_end') @stack('bulk_action_row_input_end')

View File

@ -55,6 +55,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message'])) @if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else

View File

@ -60,6 +60,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message'])) @if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else

View File

@ -19,6 +19,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['masked'])) @if (isset($attributes['masked']))
:masked="{{ ($attributes['masked']) ? 'true' : 'false' }}" :masked="{{ ($attributes['masked']) ? 'true' : 'false' }}"
@endif @endif

View File

@ -71,6 +71,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message'])) @if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else

View File

@ -49,6 +49,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message'])) @if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else

View File

@ -65,6 +65,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message'])) @if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else

View File

@ -43,6 +43,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message'])) @if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else

View File

@ -67,6 +67,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message'])) @if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else

View File

@ -45,6 +45,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message'])) @if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else

View File

@ -43,6 +43,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if (isset($attributes['v-error-message'])) @if (isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else

View File

@ -48,6 +48,10 @@
:disabled="{{ $attributes['disabled'] }}" :disabled="{{ $attributes['disabled'] }}"
@endif @endif
@if (isset($attributes['show']))
v-if="{{ $attributes['show'] }}"
@endif
@if(isset($attributes['v-error-message'])) @if(isset($attributes['v-error-message']))
:form-error="{{ $attributes['v-error-message'] }}" :form-error="{{ $attributes['v-error-message'] }}"
@else @else