File: /var/www/admin.javaapp.co.uk/resources/views/cafe/manage-loyalty-stamp/stamps.blade.php
<x-app-layout>
<x-slot name="css">
<link rel="stylesheet" href="{{ asset('plugins/select2/select2.min.css') }}">
<style>
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
.form-group label,
label {
text-transform: capitalize;
}
.buttons{
margin-top: calc(100vh - 82vh) !important;
}
</style>
</x-slot>
<x-app-breadcrumb>
<li class="breadcrumb-item">
<a href="{{ $cancelUrl }}" class="breadcrumb_home">
{{ __('common.ManageLoyaltyStamp') }}
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ $title }}</li>
</x-app-breadcrumb>
<div class="page-header row">
<div class="page-title col-12 d-flex pr-4">
<h3 class="my-auto">{{ $title }}
</h3>
</div>
</div>
<div class="row layout-top-spacing">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 layout-spacing">
{{-- <x-flash-message></x-flash-message> --}}
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<form class="mt-4" method="POST" id="cafe_loyalty_stamp_form" action="{{ $url }}">
@csrf
@if (!$addPage)
@method('PUT')
@endif
<div class="row mt-5">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 row">
<div class="col-xl-4 col-lg-4 col-md-14 col-sm-12 col-12 form-group">
<label for="stamp_color" class="form-label">{{ __('common.stamp_color') }}*</label>
<select id="stamp_color" name="stamp_color"
class="form-control @error('stamp_color') is-invalid @enderror">
<option value="">{{ __('common.selectStampColor') }}
</option>
@foreach ($colors as $index => $color)
<option value="{{ $index }}" data-src="{{ $color }}"
{{ isset($stamp_color) && $stamp_color == $index ? 'selected' : '' }}>
{{ $index }}
</option>
@endforeach
</select>
@error('stamp_color')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12 form-group">
<label for="stamp_no" class="form-label">{{ __('common.noOfTotalStamp') }}</label>
<select id="stamp_no" name="stamp_no"
class="form-control @error('stamp_no') is-invalid @enderror">
<option value="">{{ __('common.selectStampNo') }}
</option>
@for ($index = 6; $index <= 12; $index++)
<option value="{{ $index }}"
{{ isset($stamp_no) && $stamp_no == $index ? 'selected' : '' }}>
{{ $index }}
</option>
@endfor
</select>
@error('stamp_no')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12 form-group">
<label for="exclude_item" class="form-label">{{ __('common.excludeItem') }}</label>
<select id="exclude_item" name="exclude_item[]"
class="form-control @error('exclude_item') is-invalid @enderror"
multiple="multiple" placeholder="{{ __('common.selectExcludeItem') }}">
@foreach ($excludeItems as $index => $item)
<option value="{{ $index }}" {{ isset($exclude_items) && in_array($index, $exclude_items) ? 'selected' : '' }}>
{{ $item }}
</option>
@endforeach
</select>
@error('phone')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12 form-group mt-5">
<label for="discount_type"
class="form-label">{!! __('common.discount_type') !!}</label>
<select id="discount_type" name="discount_type"
class="form-control @error('discount_type') is-invalid @enderror">
<option value="">{!! __('common.selectDiscountType') !!}
</option>
@foreach ($discount_types as $index => $type)
<option value="{{ $index }}"
{{ isset($discount_type) && $discount_type == $index ? 'selected' : '' }}>
{{ $type }}
</option>
@endforeach
</select>
@error('discount_type')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12 form-group mt-5">
<label for="discount" class="form-label">{!! __('common.discount') !!}</label>
<input type="number"
class="form-control text-wrap @error('discount') is-invalid @enderror" maxlength="6"
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
id="discount" name="discount" placeholder="{!! __('common.EnterDiscount') !!}"
value="{{ isset($discount) && $discount != null ? $discount : '' }}">
@error('discount')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12 form-group mt-5">
<label for="min_order_value"
class="form-label">{{ __('common.minOrderValue') }} (�)</label>
<input type="number"
class="form-control @error('min_order_value') is-invalid @enderror"
id="min_order_value" name="min_order_value" maxlength="6"
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
placeholder="{{ __('common.EnterMinOrderValue') }}"
value="{{ isset($min_order_value) && $min_order_value != null ? $min_order_value : '' }}">
@error('min_order_value')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12 form-group mt-5">
<label for="offer_text"
class="form-label">{{ __('common.offerText') }}</label>
<input type="text"
class="form-control @error('offer_text') is-invalid @enderror"
id="offer_text" name="offer_text"
placeholder="{!! __('common.EnterOfferText') !!}"
value="{{ isset($offer_text) && $offer_text != null ? $offer_text : '' }}">
@error('offer_text')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12 form-group mt-5">
<label for="stamp_expires_in"
class="form-label">{{ __('common.stampExpireIn') }} "optional"</label>
<input type="number"
class="form-control @error('stamp_expires_in') is-invalid @enderror"
id="stamp_expires_in" name="stamp_expires_in" maxlength="2"
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
placeholder="{{ __('common.EnterStampExpireIn') }}"
value="{{ isset($stamp_expires_in) && $stamp_expires_in != null ? $stamp_expires_in : '' }}">
@error('stamp_expires_in')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<!-- stamp applicable to categories -->
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12 form-group mt-5">
<label for="stamp_applicable_to" class="form-label">Categories discount applies to</label>
<select id="stamp_applicable_to" name="stamp_applicable_to[]"
class="form-control @error('stamp_applicable_to') is-invalid @enderror" multiple="multiple"
aria-label="Categories discount applies to">
<option value="all" {{ (old('stamp_applicable_to') && in_array((string) 'all', old('stamp_applicable_to') ?? [])) || (isset($stamp_applicable_to) && in_array((string) 'all', $stamp_applicable_to)) ? 'selected' : '' }}>All</option>
@foreach ($stampApplicableTo as $item)
<option value="{{ $item->cafe_menu_id }}" {{ (old('stamp_applicable_to') && in_array((string) $item->cafe_menu_id, old('stamp_applicable_to') ?? [])) || (isset($stamp_applicable_to) && in_array((string) $item->cafe_menu_id, $stamp_applicable_to)) ? 'selected' : '' }}>
{{ $item->menu_name }}
</option>
@endforeach
</select>
@error('stamp_applicable_to')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
</div>
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mx-0 px-0 buttons">
<a href="{{ $cancelUrl }}"
class="btn btn-coffee-dark mt-4 py-2 px-4">{{ __('common.Cancel') }}</a>
<button type="submit"
class="btn btn-coffee-light mt-4 mx-3 py-2 px-4">{{ ($addPage) ? __('common.Save') : __('common.Update') }}</button>
</div>
</form>
</div>
</div>
</div>
</div>
<x-slot name="script">
<script src="{{ asset('assets/js/libs/jquery.validate.min.js') }}"></script>
<script src="{{ asset('assets/js/libs/additional-methods.min.js') }}"></script>
<script src="{{ asset('plugins/select2/select2.min.js') }}"></script>
<script>
const validation = {};
validation.stamp_color_required = "{{ __('validation.validation.stamp_color.required') }}";
validation.stamp_no_required = "{{ __('validation.validation.stamp_no.required') }}";
validation.discount_type_required = "{{ __('validation.validation.discount_type.required') }}";
validation.discount_required = "{{ __('validation.validation.discount.required') }}";
validation.discount_maxlength = "{{ __('validation.validation.discount.maxlength') }}";
validation.min_order_value_required = "{{ __('validation.validation.min_order_value.required') }}";
validation.min_order_value_maxlength = "{{ __('validation.validation.min_order_value.maxlength') }}";
validation.offer_text_required = "{{ __('validation.validation.offer_text.required') }}";
validation.offer_text_minlength = "{{ __('validation.validation.offer_text.minlength') }}";
validation.offer_text_maxlength = "{{ __('validation.validation.offer_text.maxlength') }}";
validation.stamp_expires_in_required = "{{ __('validation.validation.stamp_expires_in.required') }}";
validation.stamp_expires_in_minlength = "{{ __('validation.validation.stamp_expires_in.minlength') }}";
validation.stamp_expires_in_maxlength = "{{ __('validation.validation.stamp_expires_in.maxlength') }}";
const selectExcludedItem = "{{ __('common.selectExcludedItem') }}";
const fromElement = '#cafe_loyalty_stamp_form';
</script>
<script src="{{ asset('assets/js/cafe/addEditStamp.js') }}"></script>
<script src="{{ asset('assets/js/common-custom.js') }}"></script>
<script>
// document.getElementById('stamp_applicable_to').addEventListener('change', function () {
// const select = this;
// const selectedValues = Array.from(select.selectedOptions).map(option => option.value);
// if (selectedValues.includes('all')) {
// Array.from(select.options).forEach(option => {
// option.selected = option.value === 'all';
// });
// } else if (selectedValues.length > 1) {
// const previousValues = select.dataset.previousValues ?
// JSON.parse(select.dataset.previousValues) : [];
// if (previousValues.includes('all')) {
// select.dataset.previousValues = JSON.stringify(selectedValues);
// }
// }
// select.dataset.previousValues = JSON.stringify(selectedValues);
// });
disableSubmitAfterValidate(fromElement);
if(sessionStorage.getItem('menu_display') == 'no'){
$('.header').addClass('d-none');
}
</script>
</x-slot>
</x-app-layout>