firstcommit
This commit is contained in:
16
Modules/Estimate/resources/views/estimate/create.blade.php
Normal file
16
Modules/Estimate/resources/views/estimate/create.blade.php
Normal file
@ -0,0 +1,16 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
{{ html()->form('POST')->id('storeUpdateForm')->route('estimate.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
@include('estimate::estimate.partials.action')
|
||||
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
27
Modules/Estimate/resources/views/estimate/edit.blade.php
Normal file
27
Modules/Estimate/resources/views/estimate/edit.blade.php
Normal file
@ -0,0 +1,27 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
{{ html()->modelForm($estimate, 'PUT')->id('storeUpdateForm')->route('estimate.update', $estimate->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
@include('estimate::estimate.partials.action')
|
||||
|
||||
{{ html()->closeModelForm() }}
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
|
||||
<!-- container-fluid -->
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
82
Modules/Estimate/resources/views/estimate/index.blade.php
Normal file
82
Modules/Estimate/resources/views/estimate/index.blade.php
Normal file
@ -0,0 +1,82 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
|
||||
<div class="mb-2 text-end">
|
||||
@can('estimate.create')
|
||||
<a href="{{ route('estimate.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Add</a>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="buttons-datatables" class="display table-sm table-bordered table"
|
||||
style="width:100%">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Title</th>
|
||||
<th>Date</th>
|
||||
<th>Validity</th>
|
||||
<th>Customer</th>
|
||||
<th>Approver</th>
|
||||
<th>Approved on</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($estimates as $key => $estimate)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $estimate->title }}</td>
|
||||
<td>{{ $estimate->date?->format('Y-m-d') }}</td>
|
||||
<td>{{ $estimate->validity?->format('Y-m-d') }}</td>
|
||||
<td>{{ $estimate->customer?->customer_name }}</td>
|
||||
<td>{{ $estimate->approver?->customer_name ?? 'N/A' }}</td>
|
||||
<td>{{ $estimate->approval_on?->format('Y-m-d') ?? 'N/A' }}</td>
|
||||
<td>{{ $statusList[$estimate->approval_status] }}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('estimate.show')
|
||||
<a href="{{ route('estimate.show', $estimate->id) }}"
|
||||
class="link-info fs-15">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('estimate.edit')
|
||||
<a href="{{ route('estimate.edit', $estimate->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i
|
||||
class="ri-edit-2-line"></i></a>
|
||||
@endcan
|
||||
@can('estimate.destroy')
|
||||
<a href="javascript:void(0);"
|
||||
data-link="{{ route('estimate.destroy', $estimate->id) }}"
|
||||
data-id="{{ $estimate->id }}"
|
||||
class="link-danger fs-15 remove-item-btn"><i
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
@endcan
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -0,0 +1,361 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row gy-3">
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-1">
|
||||
{{ html()->label('Date:')->class('form-label') }}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{ html()->text('date')->class('form-control flatpickr-date bg-light border-0')->placeholder('Date')->required() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="row align-items-center justify-content-end">
|
||||
<div class="col-2">
|
||||
{{ html()->label('Estimate#')->class('form-label') }}
|
||||
</div>
|
||||
|
||||
@php
|
||||
if ($editable) {
|
||||
$estimateNumber = $estimate->estimate_no;
|
||||
} else {
|
||||
$estimateNumber = generateEstimateNumber();
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div class="col-6">
|
||||
{{ html()->text('estimate_no', $estimateNumber)->class('form-control bg-light border-0') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
{{ html()->label('Customer')->class('form-label') }}
|
||||
{{ html()->select('customer_id', $customerList)->class('form-control select2')->placeholder('Customer Name')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
{{ html()->label('Validity')->class('form-label') }}
|
||||
{{ html()->text('validity')->class('form-control flatpickr-date bg-light border-0')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Estimate for')->class('form-label') }}
|
||||
{{ html()->text('title')->class('form-control')->placeholder('Estimate for')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Condition')->class('form-label') }}
|
||||
{{ html()->text('conditions')->class('form-control')->placeholder('Conditions')->required() }}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-12 mt-4">
|
||||
<fieldset class="rounded p-3 border-1 border-muted">
|
||||
<legend class="fs-6">Estimate Details</legend>
|
||||
|
||||
<div class="row gy-3 align-items-end">
|
||||
<div class="col-lg-3">
|
||||
{{ html()->label('Item')->class('form-label') }}
|
||||
{{ html()->select(null, $billingComponentList)->class('form-control select2 item')->placeholder('Billing Component') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
{{ html()->label('Price')->class('form-label') }}
|
||||
{{ html()->number(null)->class('form-control price')->placeholder('Price') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2">
|
||||
{{ html()->label('Qty')->class('form-label') }}
|
||||
{{ html()->number(null)->class('form-control qty')->placeholder('Quantity') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
{{ html()->label('Taxable')->class('form-label') }}
|
||||
{{ html()->select(null, ['1' => 'Yes', '0' => 'No'], 1)->class('form-control select2 taxable')->placeholder('Yes/No') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 text-end">
|
||||
<a href="javascript:void(0)"
|
||||
class="btn btn-soft-secondary fw-medium add-item-btn"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Add Item</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered border-muted table-sm">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th scope="col">S.N</th>
|
||||
<th scope="col">Particular</th>
|
||||
<th scope="col">Qty</th>
|
||||
<th scope="col">Rate</th>
|
||||
<th scope="col" width=20%>Non-Taxable</th>
|
||||
<th scope="col" width=20%>Taxable</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if ($editable)
|
||||
@foreach ($estimate->estimateDetails as $index => $item)
|
||||
<tr>
|
||||
<th scope="row">
|
||||
{{$index + 1}}
|
||||
</th>
|
||||
<td>${item->text}</td>
|
||||
<td>${price.value}</td>
|
||||
<td>${qty.value}</td>
|
||||
<td class="non-taxable-amount">${taxable.value == 1 ? '-' : qty.value * price.value}</td>
|
||||
<td class="taxable-amount">${taxable.value == 0 ? '-' : qty.value * price.value}</td>
|
||||
<td>
|
||||
<a href="javascript:void(0)" class="btn btn-sm btn-soft-danger remove-item-btn" data-index=${index}>
|
||||
<i class="ri-subtract-line align-middle"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>Total</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
{{ html()->text('totalNonTaxable')->class('form-control border-0')->id('non-taxable-total')->placeholder('0.00')->isReadOnly(true) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ html()->text('totalTaxable')->class('form-control border-0')->id('taxable-total')->placeholder('0.00')->isReadOnly(true) }}
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end mb-2">
|
||||
<table class="table-borderless align-middle">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">Tax(13%)</th>
|
||||
<td>
|
||||
{{ html()->text('tax')->class('form-control bg-light border-0')->id('tax')->placeholder('0.00')->isReadOnly(true) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Total Tax</th>
|
||||
<td>
|
||||
{{ html()->text('amountWithTax')->class('form-control bg-light border-0')->id('amount-with-tax')->placeholder('0.00')->isReadOnly(true) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-top border-top-dashed">
|
||||
<th scope="row">Grand Total</th>
|
||||
<td>
|
||||
{{ html()->text('grandTotal')->class('form-control bg-light border-0')->id('grand-total')->placeholder('0.00')->isReadOnly(true) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<x-form-buttons :editable="$editable" label="Add" href="{{ route('estimate.index') }}" />
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
let dataArray = [];
|
||||
|
||||
let index = 0;
|
||||
|
||||
$('.add-item-btn').click(function() {
|
||||
|
||||
const selectedElements = $('.item, .price, .qty, .taxable');
|
||||
|
||||
let entry = getSelectedValues(selectedElements);
|
||||
|
||||
console.log(entry);
|
||||
|
||||
if (entry) {
|
||||
updateTable(entry);
|
||||
calculate();
|
||||
$('.price, .qty').val('');
|
||||
}
|
||||
});
|
||||
|
||||
function getSelectedValues(selectedElements) {
|
||||
let isEmpty = false;
|
||||
let selectedValues = selectedElements.map((_, el) => {
|
||||
try {
|
||||
const $el = $(el);
|
||||
|
||||
if ($el.val() === '') {
|
||||
$el.focus();
|
||||
isEmpty = true;
|
||||
throw new Error('Empty value encountered');
|
||||
}
|
||||
|
||||
if ($el.is('select')) {
|
||||
return {
|
||||
text: $el.find('option:selected').text().trim(),
|
||||
value: $el.val(),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
value: $el.val(),
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("An error occurred:", error);
|
||||
return null;
|
||||
}
|
||||
}).get();
|
||||
|
||||
if (isEmpty) {
|
||||
|
||||
return null;
|
||||
|
||||
} else {
|
||||
|
||||
return selectedValues;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function updateTable(entry) {
|
||||
|
||||
const [item, price, qty, taxable] = entry;
|
||||
|
||||
try {
|
||||
|
||||
const data = {
|
||||
billing_component_id: item.value,
|
||||
price: price.value,
|
||||
qty: qty.value,
|
||||
taxable: taxable.value,
|
||||
tax_amount: taxable.value ? price.value * qty.value : 0,
|
||||
};
|
||||
|
||||
dataArray.push(data);
|
||||
|
||||
console.log(dataArray);
|
||||
|
||||
let tableBody = $('.table tbody');
|
||||
let html = `
|
||||
<tr>
|
||||
<th scope="row">
|
||||
${tableBody.children().length + 1}
|
||||
</th>
|
||||
<td>${item.text}</td>
|
||||
<td>${price.value}</td>
|
||||
<td>${qty.value}</td>
|
||||
<td class="non-taxable-amount">${taxable.value == 1 ? '-' : qty.value * price.value}</td>
|
||||
<td class="taxable-amount">${taxable.value == 0 ? '-' : qty.value * price.value}</td>
|
||||
<td>
|
||||
<a href="javascript:void(0)" class="btn btn-sm btn-soft-danger remove-item-btn" data-index=${index}>
|
||||
<i class="ri-subtract-line align-middle"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
tableBody.append(html);
|
||||
|
||||
index++;
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
function calculate() {
|
||||
let totalTaxable = 0;
|
||||
let totalNonTaxable = 0;
|
||||
let amountWithTax = 0;
|
||||
let grandTotal = 0;
|
||||
|
||||
$('.taxable-amount').each(function() {
|
||||
var value = parseFloat($(this).text());
|
||||
if (!isNaN(value)) {
|
||||
totalTaxable += value;
|
||||
}
|
||||
});
|
||||
|
||||
$('.non-taxable-amount').each(function() {
|
||||
var value = parseFloat($(this).text());
|
||||
if (!isNaN(value)) {
|
||||
totalNonTaxable += value;
|
||||
}
|
||||
});
|
||||
|
||||
taxAmount = (totalTaxable * 0.13).toFixed(2);
|
||||
amountWithTax = totalTaxable + parseFloat(taxAmount);
|
||||
grandTotal = (totalNonTaxable + parseFloat(amountWithTax)).toFixed(2);
|
||||
|
||||
$('#tax').val(taxAmount);
|
||||
$('#amount-with-tax').val(amountWithTax);
|
||||
$('#grand-total').val(grandTotal);
|
||||
$('#non-taxable-total').val(totalNonTaxable);
|
||||
$('#taxable-total').val(totalTaxable);
|
||||
}
|
||||
|
||||
$(".table").on('click', '.remove-item-btn', function() {
|
||||
removeItem(this);
|
||||
});
|
||||
|
||||
function removeItem(element) {
|
||||
$(element).closest('tr').remove();
|
||||
const dataIndex = $(element).data('index');
|
||||
console.log(dataIndex);
|
||||
dataArray.splice(dataIndex, 1);
|
||||
console.log(dataArray);
|
||||
calculate();
|
||||
};
|
||||
|
||||
$(document).on('submit', '#storeUpdateForm', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
let estimateDetails = JSON.stringify(dataArray);
|
||||
|
||||
let hiddenInput = $("<input>")
|
||||
.attr("type", "hidden")
|
||||
.attr("name", "estimateDetails")
|
||||
.val(estimateDetails);
|
||||
|
||||
$('#storeUpdateForm').append(hiddenInput);
|
||||
|
||||
this.submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
257
Modules/Estimate/resources/views/estimate/show.blade.php
Normal file
257
Modules/Estimate/resources/views/estimate/show.blade.php
Normal file
@ -0,0 +1,257 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xxl-9">
|
||||
<div class="card" id="demo">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card-header border-bottom-dashed p-4 ribbon-box border shadow-none right mb-lg-0">
|
||||
<x-ribbon :status="$estimate->approval_status"/>
|
||||
<div class="d-flex mt-4">
|
||||
<div class="flex-grow-1">
|
||||
<img src="{{ asset('assets/images/logo-dark.png') }}"
|
||||
class="card-logo card-logo-dark" alt="logo dark" height="17">
|
||||
<img src="{{ asset('assets/images/logo-light.png') }}"
|
||||
class="card-logo card-logo-light" alt="logo light" height="17">
|
||||
<div class="mt-sm-5 mt-4">
|
||||
<h6 class="text-muted text-uppercase fw-semibold">Address</h6>
|
||||
<p class="text-muted mb-1" id="address-details">California, United States
|
||||
</p>
|
||||
<p class="text-muted mb-0" id="zip-code"><span>Zip-code:</span> 90201</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-shrink-0 mt-sm-0 mt-3">
|
||||
<h6><span class="text-muted fw-normal">Estimate No: </span><span
|
||||
id="legal-register-no">{{$estimate->estimate_no}}</span></h6>
|
||||
<h6><span class="text-muted fw-normal">Date: </span><span
|
||||
id="email">{{ $estimate->date->format('Y-m-d') }}</span></h6>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end card-header-->
|
||||
</div><!--end col-->
|
||||
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="card-body p-4 border-top border-top-dashed">
|
||||
<div class="row g-3">
|
||||
<div class="col-4">
|
||||
<fieldset class="border-2 text-muted">
|
||||
<legend>
|
||||
<h6 class="text-dark">To,</h6>
|
||||
</legend>
|
||||
<p class="fw-medium text-uppercase mb-2" id="billing-name">
|
||||
{{ $estimate->customer?->customer_name ?? 'N/A' }}</p>
|
||||
<p class="text-muted mb-1 text-uppercase" id="billing-address-line-1">
|
||||
{{ $estimate->customer?->address ?? 'N/A' }}</p>
|
||||
<p class="text-muted mb-1"><span>Phone: </span><span
|
||||
id="billing-phone-no">{{ $estimate->customer?->phone ?? 'N/A' }}</span>
|
||||
</p>
|
||||
|
||||
<div class="px-3 py-2 border border-1 border-dark m-2">
|
||||
<p class="text-dark text-bold mb-0 text-uppercase"><span>Client Pan:
|
||||
</span><span
|
||||
id="billing-tax-no">{{ $estimate->customer?->company_pan ?? 'N/A' }}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
<!--end col-->
|
||||
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
<!--end card-body-->
|
||||
</div><!--end col-->
|
||||
<div class="col-lg-12">
|
||||
<div class="card-body p-4">
|
||||
<div class="table-reponsive">
|
||||
<table class="table table-bordered table-nowrap text-center align-middle mb-0">
|
||||
<thead>
|
||||
<tr class="table-active">
|
||||
<th scope="col" style="width: 50px;">#</th>
|
||||
<th scope="col" width=30%>Description</th>
|
||||
<th scope="col" width=20%>Narration</th>
|
||||
<th scope="col">Qty</th>
|
||||
<th scope="col">Rate</th>
|
||||
<th scope="col">Non Taxable</th>
|
||||
<th scope="col" class="text-center">Taxable</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="products-list">
|
||||
@if ($estimate->estimateDetails->isNotEmpty())
|
||||
@foreach ($estimate->estimateDetails as $index => $item)
|
||||
<tr>
|
||||
<th scope="row">{{ $index + 1 }}</th>
|
||||
<td class="text-center">
|
||||
<span class="fw-medium"></span>
|
||||
<p class="text-muted mb-0">
|
||||
{{ $item->billingComponent?->title ?? 'N/A' }}</p>
|
||||
</td>
|
||||
<td>{{ $item->billingComponent?->unit }}</td>
|
||||
<td>{{ $item->qty }}</td>
|
||||
<td class="text-center">{{ $item->billingComponent?->price }}
|
||||
</td>
|
||||
<td class="non-taxable-amount">{{ $item->billingComponent?->taxable == 0 ? $item->qty * $item->billingComponent?->price : '' }}
|
||||
</td>
|
||||
<td class="taxable-amount">{{ $item->billingComponent?->taxable == 1 ? $item->qty * $item->billingComponent?->price : '' }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4" class="text-start"> Amount in words:</td>
|
||||
<td class="text-end">Total (A):</td>
|
||||
<td id="non-taxable-total">0.00</td>
|
||||
<td class="taxable-total">0.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" rowspan="4" id="amount-in-words" class="text-capitalize"></td>
|
||||
<td colspan="2" class="text-end">Taxable Total</td>
|
||||
<td class="taxable-total">0.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="text-end">VAT (13%)</td>
|
||||
<td id="tax">0.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="text-end">Amount After Tax (B)</td>
|
||||
<td id="amount-with-tax">0.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="text-end">Grand Total (A+B)</td>
|
||||
<td class="grand-total">0.00</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
</table><!--end table-->
|
||||
</div>
|
||||
|
||||
{{-- <div class="mt-3">
|
||||
<h6 class="text-muted text-uppercase fw-semibold mb-3">Estimate Details:</h6>
|
||||
<p class="text-muted mb-1">Total Amount: <span class="fw-medium grand-total"
|
||||
id="card-number">0.00</span></p>
|
||||
<p class="text-muted">Amount in words: <span class="fw-medium" id="">$
|
||||
</span><span id="card-total-amount">One Lakh Five Thousand only /-</span></p>
|
||||
</div> --}}
|
||||
|
||||
<div class="hstack gap-2 justify-content-end d-print-none mt-4">
|
||||
<a href="javascript:window.print()" class="btn btn-info"><i
|
||||
class="ri-printer-line align-bottom me-1"></i> Print</a>
|
||||
|
||||
@if ($estimate->approval_status != 3)
|
||||
<a href="javascript:void(0);" class="btn btn-success" data-bs-toggle="modal"
|
||||
data-bs-target="#approveModal"><i
|
||||
class="ri-check-double-line align-bottom me-1"></i> Approve</a>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--end card-body-->
|
||||
</div><!--end col-->
|
||||
</div><!--end row-->
|
||||
</div>
|
||||
<!--end card-->
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Grids in modals -->
|
||||
<div class="modal fade" id="approveModal" tabindex="-1" aria-labelledby="approveModalLabel" aria-modal="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="approveModalLabel">Approve Form</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('estimate.changeStatus') }}" class="needs-validation" method="POST"
|
||||
novalidate>
|
||||
@csrf
|
||||
<div class="row g-3">
|
||||
{{ html()->hidden('estimate_id', $item->id) }}
|
||||
<div class="col-12">
|
||||
<div>
|
||||
{{ html()->label('Status')->for('status')->class('form-label') }}
|
||||
{{ html()->select('approval_status', $statusList, $item->status)->id('status')->class('form-control select2') }}
|
||||
</div>
|
||||
</div><!--end col-->
|
||||
|
||||
<div class="col-12">
|
||||
<div>
|
||||
{{ html()->label('Remarks')->for('approval_remarks')->class('form-label') }}
|
||||
{{ html()->textarea('approval_remarks')->id('approval_remarks')->class('form-control')->attributes(['rows' => 3]) }}
|
||||
</div>
|
||||
</div><!--end col-->
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="hstack gap-2 justify-content-end">
|
||||
<button type="button" class="btn btn-sm btn-light"
|
||||
data-bs-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-sm btn-primary">Submit</button>
|
||||
</div>
|
||||
</div><!--end col-->
|
||||
|
||||
</div><!--end row-->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
<script class="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
calculate();
|
||||
});
|
||||
|
||||
function calculate() {
|
||||
let totalTaxable = 0;
|
||||
let totalNonTaxable = 0;
|
||||
let amountWithTax = 0;
|
||||
let grandTotal = 0;
|
||||
|
||||
$('.taxable-amount').each(function() {
|
||||
var value = parseFloat($(this).text());
|
||||
if (!isNaN(value)) {
|
||||
totalTaxable += value;
|
||||
}
|
||||
});
|
||||
|
||||
$('.non-taxable-amount').each(function() {
|
||||
var value = parseFloat($(this).text());
|
||||
if (!isNaN(value)) {
|
||||
totalNonTaxable += value;
|
||||
}
|
||||
});
|
||||
|
||||
taxAmount = (totalTaxable * 0.13).toFixed(2);
|
||||
amountWithTax = totalTaxable + parseFloat(taxAmount);
|
||||
grandTotal = (totalNonTaxable + parseFloat(amountWithTax)).toFixed(2);
|
||||
const amountInWords = `${amountToWords(grandTotal)} Only /-`;
|
||||
|
||||
$('#tax').text(taxAmount);
|
||||
$('#amount-with-tax').text(amountWithTax);
|
||||
$('.grand-total').text(grandTotal);
|
||||
$('#non-taxable-total').text(totalNonTaxable);
|
||||
$('.taxable-total').text(totalTaxable);
|
||||
$('#amount-in-words').text(amountInWords);
|
||||
}
|
||||
</script>
|
||||
@endpush
|
Reference in New Issue
Block a user