added store password

This commit is contained in:
franknstayn
2021-07-19 20:49:11 +08:00
parent 89a94bd0ca
commit 145ea90974
4 changed files with 103 additions and 16 deletions

View File

@@ -162,7 +162,7 @@ class PaypalController extends Controller
// $order_subtotal = $updated_getSubtotal[0]->Subtotal; // $order_subtotal = $updated_getSubtotal[0]->Subtotal;
$order_grandtotal = $updated_getSubtotal[0]->Subtotal; $order_grandtotal = $updated_getSubtotal[0]->Subtotal;
if ($grouped_item[0]->StoreId == 76 || $grouped_item[0]->StoreId == 78 || $grouped_item[0]->StoreId == 111 || $grouped_item[0]->StoreId == 131 || $grouped_item[0]->StoreId == 30 || $grouped_item[0]->StoreId == 141 || $grouped_item[0]->StoreId == 162 || $grouped_item[0]->StoreId == 185) { if ($grouped_item[0]->StoreId == 76 || $grouped_item[0]->StoreId == 78 || $grouped_item[0]->StoreId == 111 || $grouped_item[0]->StoreId == 131 || $grouped_item[0]->StoreId == 30 || $grouped_item[0]->StoreId == 141 || $grouped_item[0]->StoreId == 162 || $grouped_item[0]->StoreId == 185 || $grouped_item[0]->StoreId == 244) {
$tax_value = 0; $tax_value = 0;
} else { } else {
$tax_value = 0.10; $tax_value = 0.10;

View File

@@ -14,6 +14,7 @@ use App\Models\user\UserModel;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Analytics; use Analytics;
use App\Models\TemplatesModel; use App\Models\TemplatesModel;
use Illuminate\Support\Facades\Session;
class TeamStoreController extends Controller class TeamStoreController extends Controller
{ {
@@ -40,7 +41,7 @@ class TeamStoreController extends Controller
if ($store_array[0]->Password != null) { if ($store_array[0]->Password != null) {
if ($request->session()->get('teamstore_data_array') == null) { if ($request->session()->get('teamstore_data_array') == null) {
if ($store_id != $store_array[0]->Id) { if ($store_id != $store_array[0]->Id) {
return redirect('teamstore'); return redirect('/');
} }
} else { } else {
@@ -175,9 +176,16 @@ class TeamStoreController extends Controller
if ($store_array) { if ($store_array) {
$request->session()->put('teamstore_data_array', $store_array); $request->session()->put('teamstore_data_array', $store_array);
return redirect('teamstore/' . $store_array[0]->StoreUrl); return redirect('store/' . $store_array[0]->StoreUrl);
} else { } else {
return redirect()->back()->with('errors', 'Invalid Password.'); Session::flash('errors', 'Invalid Password');
echo '<script>
alert("Invalid Password");
window.history.back();
</script>';
// return redirect('cart');
// return redirect('/');
} }
} }

View File

@@ -151,10 +151,27 @@ li.footer-menu-item a:hover {
} }
.store-logo { .store-logo {
height: 165px; height: 165px;
display: inline-block;
/* border: 1px solid #e2e2e2; */ /* border: 1px solid #e2e2e2; */
position: relative; position: relative;
} }
.store-locked{
background-color: rgb(0 0 0 / 60%);
height: 100%;
width: 100%;
top: 0;
left: 0;
position: absolute;
padding: 67px;
text-align: center;
}
.store-locked > i {
font-size: 2rem;
color: #ffffff;
}
.store-logo img { .store-logo img {
object-fit: contain; object-fit: contain;
width: 100%; width: 100%;

View File

@@ -2,8 +2,35 @@
@foreach ($stores_array as $store) @foreach ($stores_array as $store)
<div class="col-lg-2 col-md-3 col-sm-4"> <div class="col-lg-2 col-md-3 col-sm-4">
<div class="p-3 store"> <div class="p-3 store">
{{--
@if($store->Password != null )
<a class="thumbnail password-protected" href="#" data-store-id="{{ $store->Id }}" data-store-url="{{ $store->StoreUrl }}">
<img class="store-logo" src="{{ config('site_config.uploads') . 'teamstore/'. $store->ImageFolder . '/' . $store->StoreLogo }}">
</a>
<h4 style="border-top: 1px solid #dddddd; padding: 10px; font-size: 16px; font-weight: bold; text-transform: uppercase;" class="text-center">{{ $store->StoreName }} <i class="fa fa-lock" title="This store is password protected."></i></h4>
@else
<a class="thumbnail" href="{{ url('teamstore') . '/' . $store->StoreUrl }}">
<img class="store-logo" src="{{ config('site_config.uploads') . 'teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo }}">
</a>
<h4 style="border-top: 1px solid #dddddd; padding: 10px; font-size: 16px; font-weight: bold; text-transform: uppercase;" class="text-center">{{ $store->StoreName }}</h4>
@endif --}}
@if($store->Password != null )
<a href="#">
<div class="store-logo password-protected" data-store-id="{{ $store->Id }}" data-store-url="{{ $store->StoreUrl }}">
<img
src="{{ config('site_config.uploads') . 'teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo }}"
class="d-block"
alt="{{ $store->StoreName }}"
/>
<div class="store-locked">
<i class="fa fa-lock"></i>
</div>
</div>
<div class="store-name">{{ $store->StoreName }} <i class="fa fa-lock" title="This store is password protected."></i></div>
</a>
@else
<a href="{{ url('store') . '/' . $store->StoreUrl }}"> <a href="{{ url('store') . '/' . $store->StoreUrl }}">
<div class="store-logo" v-if="index === 1"> <div class="store-logo">
<img <img
src="{{ config('site_config.uploads') . 'teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo }}" src="{{ config('site_config.uploads') . 'teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo }}"
class="d-block" class="d-block"
@@ -12,6 +39,7 @@
</div> </div>
<div class="store-name">{{ $store->StoreName }}</div> <div class="store-name">{{ $store->StoreName }}</div>
</a> </a>
@endif
</div> </div>
</div> </div>
@endforeach @endforeach
@@ -25,7 +53,7 @@
</div> --}} </div> --}}
</div> </div>
<div id="team-store-login" class="modal fade" role="dialog"> {{-- <div id="team-store-login" class="modal fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<!-- Modal content--> <!-- Modal content-->
@@ -69,4 +97,38 @@
</div> </div>
</div> </div>
</div> </div> --}}
{{-- <div id="team-store-login" class="modal fade" role="dialog"> --}}
<div class="modal fade" id="team-store-login" tabindex="-1" aria-labelledby="storeLoginLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form class="form-horizontal" role="form" method="POST" action="{{ url('store/checkpassword') }}">
<div class="modal-header">
<h5 class="modal-title" id="storeLoginLabel">Store Login</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
@if (\Session::has('errors'))
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>Whoops!</strong> {!! \Session::get('errors') !!}.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
@endif
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" class="form-control" id="_teamstore_id" name="store_id">
<label class="col-md-4 control-label">Store Password</label>
<div class="input-group mb-3">
<input type="password" class="form-control pwd" name="password" placeholder="Store Password" aria-label="Store Password" aria-describedby="button-addon2">
<button class="btn btn-outline-secondary reveal-password" type="button" id="button-addon2"><i class="fa fa-eye"></i></button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-black">Submit</button>
</div>
</form>
</div>
</div>
</div>