This commit is contained in:
Sampanna Rimal
2024-09-11 12:32:15 +05:45
parent 82fab174dc
commit afb2c202d6
170 changed files with 3352 additions and 363 deletions

View File

@ -0,0 +1,7 @@
@extends('salesentry::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>Module: {!! config('salesentry.name') !!}</p>
@endsection

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>SalesEntry Module - {{ config('app.name', 'Laravel') }}</title>
<meta name="description" content="{{ $description ?? '' }}">
<meta name="keywords" content="{{ $keywords ?? '' }}">
<meta name="author" content="{{ $author ?? '' }}">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
{{-- Vite CSS --}}
{{-- {{ module_vite('build-salesentry', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-salesentry', 'resources/assets/js/app.js') }} --}}
</body>

View File

@ -0,0 +1,46 @@
<div class="card card-body product-card card-border-secondary mb-2 border">
<div class="row gy-2 mb-2">
<div class="col-md-4">
{{ html()->label('Product')->class('form-label') }}
@if (isset($editable) && $editable)
{{ html()->select('product_id[]', $productList, $item->product_id)->class('form-select product_id')->attributes(['id' => 'product_id'])->placeholder('Enter Product Name')->required() }}
@else
@endif
{{ html()->select('product_id[]', $productList)->class('form-select product_id')->attributes(['id' => 'product_id'])->placeholder('Enter Product Name')->required() }}
</div>
<div class="col-md-2">
{{ html()->label('Unit')->class('form-label') }}
{{ html()->text('unit[]', isset($editable) && $editable ? $item->unit : null)->class('form-control unit')->placeholder('Enter Unit')->required()->attributes(['id' => 'unit']) }}
</div>
<div class="col-md-2">
{{ html()->label('Rate')->class('form-label') }}
{{ html()->text('rate[]', isset($editable) && $editable ? $item->rate : null)->class('form-control product-price cleave-numeral rate~~')->placeholder('Enter Rate')->attributes(['id' => 'rate']) }}
</div>
<div class="col-md-2">
{{ html()->label('Quantity')->class('form-label') }}
{{ html()->text('qty[]', isset($editable) && $editable ? $item->quantity : null)->class('form-control product-quantity cleave-numeral qty')->placeholder('Enter QTY')->attributes(['id' => 'qty']) }}
</div>
<div class="col-md-2">
{{ html()->label('Amount')->class('form-label') }}
{{ html()->text('amt[]', isset($editable) && $editable ? $item->amount : null)->class('form-control product-line-price bg-light')->placeholder('Enter Amount')->isReadOnly() }}
</div>
<div class="col-md-6">
{{ html()->label('Description')->class('form-label') }}
{{ html()->text('desc[]', isset($editable) && $editable ? $item->desc : null)->class('form-control')->placeholder('Enter Description') }}
</div>
<div class="col-md-6 d-flex justify-content-end align-items-end">
<button type="button" class="btn btn-danger btn-icon waves-effect btn-remove waves-light"><i
class="ri-delete-bin-5-line"></i></button>
</div>
</div>
</div>

View 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 -->
<div class="card">
<div class="card-body">
<form action="{{ route('salesEntry.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('salesEntry::salesEntry.partials.action')
</form>
</div>
</div>
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
{{ html()->modelForm($order, 'PUT')->route('order.update', $id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('order::order.partials.action')
{{ html()->closeModelForm() }}
</div>
</div>
</div>
</div>
<!--end row-->
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,68 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header align-items-center d-flex">
<h5 class="card-title flex-grow-1 mb-0">{{ $title }}</h5>
<div class="flex-shrink-0">
<a href="{{ route('salesEntry.create') }}" class="btn btn-success waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Add</a>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="buttons-datatables" class="display table-sm table-bordered table"
style="width:100%">
<thead>
<tr>
<th>S.N</th>
<th>Customer</th>
<th>Sales Date</th>
<th>Total Amount</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@forelse ($salesEntries as $key => $item)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $item->customer->customer_name }}</td>
<td>{{ $item->sales_date }}</td>
<td>{{ $item->total_amt }}</td>
<td>
<div class="hstack flex-wrap gap-3">
<a href="javascript:void(0);" class="link-info fs-15 view-item-btn"
data-bs-toggle="modal" data-bs-target="#viewModal">
<i class="ri-eye-line"></i>
</a>
<a href="{{ route('salesEntry.edit', $item->id) }}"
class="link-success fs-15 edit-item-btn"><i
class="ri-edit-2-line"></i></a>
<a href="javascript:void(0);"
data-link="{{ route('salesEntry.destroy', $item->id) }}"
data-id="{{ $item->id }}"
class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-line"></i></a>
</div>
</td>
</tr>
@empty
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
</div>
@endsection

View File

@ -0,0 +1,219 @@
<div class="row gy-1">
<h5 class="text-primary text-center">Order Details</h5>
<div class="border border-dashed"></div>
<div class="col-md-4">
{{ html()->label('Sales Date')->class('form-label') }}
{{ html()->date('sales_date')->class('form-control')->placeholder('Choose Sales Date')->required() }}
{{ html()->div('Please choose Sales date')->class('invalid-feedback') }}
</div>
<div class="col-md-8">
{{ html()->label('Customer')->class('form-label') }}
{{ html()->select('customer_id', $customerList)->class('form-control')->placeholder('Select Customer')->required() }}
{{ html()->div('Please select customer')->class('invalid-feedback') }}
</div>
</div>
{{-- <div class="row mt-2">
<p class="text-primary">Shipping Details</p>
<div class="border border-dashed"></div>
<div class="col-md-4">
{{ html()->label('Address')->class('form-label') }}
{{ html()->text('address')->class('form-control')->placeholder('Enter Address') }}
</div>
<div class="col-md-4">
{{ html()->label('Shipping Date')->class('form-label') }}
{{ html()->date('shiiping_date')->class('form-control')->placeholder('Enter Temporary Address') }}
</div>
</div> --}}
<div class="row gy-1 gx-2 mt-1">
<div class="d-flex justify-content-end">
<button type="button" class="btn btn-info btn-icon add-btn text-end"><i class="ri-add-line"></i></button>
</div>
@if ($editable && $salesEntry->salesEntryDetail->isNotEmpty())
@foreach ($salesEntry->salesEntryDetail as $item)
@include('salesEntry::salesEntry.clone-product')
@endforeach
@else
@include('salesEntry::salesEntry.clone-product')
@endif
<div class="appendProductCard"></div>
</div>
<div class="d-flex justify-content-end w-30 mb-2">
<table class="table-borderless align-middle">
<tbody>
{{-- <tr>
<th scope="row">Sub Total</th>
<td style="width:150px;">
<input type="text" name="sub_total" class="form-control bg-light border-0" id="subtotal"
placeholder="$0.00" readonly="">
</td>
</tr>
<tr>
<th scope="row">Estimated Tax (11%)</th>
<td>
<input type="text" name="tax" class="form-control bg-light border-0" id="tax"
placeholder="$0.00" readonly="">
</td>
</tr>
<tr>
<th scope="row">Discount</th>
<td>
<input type="text" name="discount_amt" class="form-control bg-light border-0" id="discount"
placeholder="$0.00" readonly="">
</td>
</tr> --}}
<tr class="border-top border-top-dashed">
<th scope="row">Total Amount</th>
<td>
<input type="text" name="total_amt" class="form-control bg-light border-0" id="total"
placeholder="$0.00" readonly="">
</td>
</tr>
</tbody>
</table>
</div>
<div class="row gy-1 my-2">
<h5 class="text-primary text-center">Payment Details</h5>
<div class="border border-dashed"></div>
<div class="col-md-4">
{{ html()->label('Payment')->class('form-label') }}
{{ html()->text('payment')->class('form-control')->placeholder('Enter Payment') }}
</div>
<div class="col-md-4">
{{ html()->label('Mode of Payment')->class('form-label') }}
{{ html()->select('paymentmode_id', $paymentModes)->class('form-select select2')->placeholder('Select Payment Mode') }}
</div>
<div class="col-md-4">
{{ html()->label('Payment Reference')->class('form-label') }}
{{ html()->text('paymentref')->class('form-control')->placeholder('Enter Payment Reference') }}
</div>
</div>
<div class="mb-4 text-end">
<button type="submit" class="btn btn-success w-sm">Save</button>
</div>
@push('js')
<script src="{{ asset('assets/libs/cleave.js/cleave.min.js') }}"></script>
<script src="{{ asset('assets/js/pages/form-masks.init.js') }}"></script>
<script>
$("body").on('click', '.add-btn', function(e) {
e.preventDefault();
numberInc = $('.product-card').length
$.ajax({
type: 'get',
url: '{{ url('clone-sales-product') }}',
data: {
numberInc: numberInc
},
success: function(response) {
$('.appendProductCard').append(response.view)
// $('#salesEntry-container').html(response.view).fadeIn()
},
error: function(xhr) {
},
});
});
$("body").on('click', '.btn-remove', function() {0
if ($('.product-card').length > 1) {
$(this).parents(".product-card").remove();
}
recalculate();
});
$(window).on('load', function() {
recalculate();
})
function amountKeyup() {
$("body").on('keyup', '.product-price', function() {
var priceInput = $(this);
var qtyInput = priceInput.closest(".row").find(".product-quantity");
var linePrice = priceInput.closest(".row").find(".product-line-price");
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
});
$("body").on('keyup', '.product-quantity', function() {
var priceInput = $(this);
var qtyInput = priceInput.closest(".row").find(".product-price");
var linePrice = priceInput.closest(".row").find(".product-line-price");
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
});
}
amountKeyup()
function updateQuantity(rate, qty, linePriceInput) {
var amount = (rate * qty).toFixed(2);
linePriceInput.val(amount);
recalculate();
}
function recalculate() {
var subtotal = 0;
$(".product-line-price").each(function() {
if ($(this).val()) {
subtotal += parseFloat($(this).val());
}
});
// var tax = subtotal * 0.125;
// var discount = subtotal * 0.15;
// var shipping = subtotal > 0 ? 65 : 0;
// var total = subtotal + tax + shipping - discount;
// $("#subtotal").val(subtotal.toFixed(2));
// $("#tax").val(tax.toFixed(2));
// $("#discount").val(discount.toFixed(2));
// $("#shipping").val(shipping.toFixed(2));
$("#total").val(subtotal.toFixed(2));
}
$(document).ready(function() {
$('body').on('change', '.product_id', function() {
var selectedId = $(this).find(':selected').val();
var formRow = $(this).closest('.row');
if (selectedId) {
$.ajax({
type: 'GET',
url: '{{ route('get-product-detail') }}',
data: {
id: selectedId
},
success: function(response) {
var qtyInput = formRow.find('#qty').val(response.data.qty);
formRow.find('#unit').val(response.data.unit);
var priceInput = formRow.find('#rate').val(response.data.price);
var linePrice = priceInput.closest(".row").find(".product-line-price");
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
},
error: function(xhr) {
}
});
}
});
});
</script>
@endpush

View File

@ -0,0 +1,16 @@
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-modal="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalgridLabel">View Leave</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form action="{{ route('leave.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('leave::leave.partials.action')
</form>
</div>
</div>
</div>
</div>