Skip to content

Commit 0af3960

Browse files
committed
fix: percentage in tax slots
1 parent 9ef6566 commit 0af3960

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

app/Http/Controllers/Auth/AuthenticatedSessionController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function store(LoginRequest $request)
4646
$request->authenticate();
4747
$request->session()->regenerate();
4848

49-
if ($user->purchased('course')->count() > 0) {
49+
if ($user->purchased('course')->count() > 0 && !$user->hasAnyRole(['admin', 'super admin'])) {
5050
$store = new Authentication();
5151
$store->user_id = auth()->id();
5252
$store->login_status = 1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class () extends Migration {
8+
/**
9+
* Run the migrations.
10+
*/
11+
public function up(): void
12+
{
13+
Schema::table('slots', function (Blueprint $table) {
14+
$table->double(column:'tax_percentage', places:6)->default(0)->change();
15+
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('slots', function (Blueprint $table) {
25+
$table->integer('tax_percentage')->default(0)->change();
26+
});
27+
}
28+
};

resources/views/backend/taxCalculator/editSettings.blade.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
label="Range To" />
1919
</div>
2020
<div class="col-md-2">
21-
<x-backend.form.text-input type="text" name="slot_percentage[]" placeholder="Percentage"
21+
<x-backend.form.text-input type="number" step="any" name="slot_percentage[]" placeholder="Percentage"
2222
label="Percentage(%)" />
2323
</div>
2424
<div class="col-md-4">
@@ -156,12 +156,12 @@ class="row only-company only-tax {{ $taxSetting->for !== 'company' && $taxSettin
156156
<div class="col-12 mb-2 slots-container">
157157
<h4 class="text-center fw-bold">Slots</h4>
158158
<div id="slot-wrapper" class="mb-2">
159-
@foreach ($taxSetting->slots as $slot)
159+
@foreach ($taxSetting->slots as $key => $slot)
160160
<div class="row border rounded p-1 mb-2"
161161
data-url="{{ route('ajax.slot.destroy', $slot->id) }}">
162162
<input type="hidden" name="slot_ids[]" value="{{ $slot->id }}">
163-
<div class="d-none slot-count">1</div>
164-
<h5 class="fw-medium mb-1">Slot 1</h5>
163+
<div class="d-none slot-count">{{++$key}}</div>
164+
<h5 class="fw-medium mb-1">Slot {{++$key}}</h5>
165165
<div class="row only-tax">
166166
<div class="col-md-3">
167167
<x-backend.form.text-input type="number" name="tax_slot_from[]"
@@ -172,7 +172,7 @@ class="row only-company only-tax {{ $taxSetting->for !== 'company' && $taxSettin
172172
placeholder="Range To" label="Range To" :value="$slot->to" />
173173
</div>
174174
<div class="col-md-2">
175-
<x-backend.form.text-input type="text" name="slot_percentage[]"
175+
<x-backend.form.text-input type="number" step="any" name="slot_percentage[]"
176176
placeholder="Percentage" label="Percentage(%)" :value="$slot->tax_percentage" />
177177
</div>
178178
<div class="col-md-4">

0 commit comments

Comments
 (0)