first initial
This commit is contained in:
553
resources/views/transaction/index.blade.php
Normal file
553
resources/views/transaction/index.blade.php
Normal file
@@ -0,0 +1,553 @@
|
||||
@extends('layouts.frontapp')
|
||||
|
||||
{{-- @section('contentHead')
|
||||
<div class="kt-subheader kt-grid__item" id="kt_subheader">
|
||||
<div class="kt-container kt-container--fluid ">
|
||||
<div class="kt-subheader__main">
|
||||
<h3 class="kt-subheader__title"> Transaksi </h3>
|
||||
</div>
|
||||
<div class="kt-subheader__toolbar" style="width: 1000px;">
|
||||
<a href="{{ route('transaction.create') }}" id="addBtn" class="btn btn-label-success btn-bold" data-url="" data-redirect="">Tambah Transaksi</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection --}}
|
||||
|
||||
@section('styles')
|
||||
<style>
|
||||
button.disabled {
|
||||
cursor: not-allowed !important;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<div class="row mb-4 mt-4">
|
||||
<div class="col-8">
|
||||
{{-- <h5 class="text-center mt-4">Cipta Kreasi Baru</h5> --}}
|
||||
<a href="/"><img src="{{ asset('logo-ckb.png') }}" style="width: 100%" alt="LOGO CKB"></a>
|
||||
</div>
|
||||
<div class="col-4 text-right my-auto">
|
||||
<a class="btn btn-sm btn-danger mt-3" style="background: red !important;" href="{{ route('logout') }}" onclick="logout(event)">
|
||||
{{ __('Logout') }}
|
||||
</a>
|
||||
|
||||
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
|
||||
@csrf
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<!--begin::Portlet-->
|
||||
<div class="kt-portlet">
|
||||
<div class="kt-portlet__head">
|
||||
<div class="kt-portlet__head-label">
|
||||
<span>{{ $mechanic->name }}</span>
|
||||
</div>
|
||||
<div class="kt-portlet__head-toolbar">
|
||||
<span class="float-right">{{ $now }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kt-portlet__body">
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<b>Dealer {{ $mechanic->dealer_name }}</b><br><br>
|
||||
<a href="#">Total {{ $count_transaction_dealers }} Pekerjaan terkirim pada dealer</a><br>
|
||||
<a href="#">Anda telah posting {{ $count_transaction_users }} pekerjaan</a>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="text-center mt-2">
|
||||
<a href="{{ route('transaction.lists') }}">
|
||||
<i style="font-size: 16px;" class="fa fa-eye"></i>
|
||||
<p>Laporan harian</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="text-center mt-2">
|
||||
<a href="{{ route('transaction.recap') }}">
|
||||
<i style="font-size: 16px;" class="fa fa-eye"></i>
|
||||
<p>Rekap Laporan</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (session('success'))
|
||||
<div class="row mt-2 mb-2">
|
||||
<div class="col-12">
|
||||
<div class="alert alert—check alert-success fade show" role="alert">
|
||||
<div class="alert-text">{{ session('success') }}</div>
|
||||
<div class="alert-close">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="la la-close"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<!--begin::Portlet-->
|
||||
<div class="kt-portlet">
|
||||
<div class="kt-portlet__body">
|
||||
<ul class="nav nav-tabs nav-tabs-line nav-tabs-line-primary" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @if(old('form') == 'wash') @else active @endif" data-toggle="tab" href="#work">Form Kerja</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @if(old('form') == 'wash') active @endif" data-toggle="tab" href="#wash">Form Cuci</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane @if(old('form') == 'wash') @else active @endif" id="work" role="tabpanel">
|
||||
<form action="{{ route('transaction.store') }}" method="POST" id="workForm">
|
||||
@csrf
|
||||
<input type="hidden" name="form" value="work">
|
||||
<input type="hidden" name="mechanic_id" value="{{ $mechanic->id }}">
|
||||
<input type="hidden" name="dealer_id" value="{{ $mechanic->dealer_id }}">
|
||||
<div class="form-group row">
|
||||
<div class="col-6">
|
||||
<input type="text" name="spk_no" class="form-control @if(old('form') == 'work') @error('spk_no') is-invalid @enderror @endif" value="{{ old('spk_no') }}" placeholder="No. SPK">
|
||||
|
||||
@if(old('form') == 'work')
|
||||
@error('spk_no')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="text" name="police_number" class="form-control @if(old('form') == 'work') @error('police_number') is-invalid @enderror" @endif value="{{ old('police_number') }}" placeholder="No. Polisi">
|
||||
@if(old('form') == 'work')
|
||||
@error('police_number')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-6">
|
||||
<select name="warranty" class="form-control @if(old('form') == 'work') @error('warranty') is-invalid @enderror @endif">
|
||||
<option selected>Warranty</option>
|
||||
<option value="1" @if(old('form') == 'work') @if(old('warranty') == 1) selected @endif @endif>Ya</option>
|
||||
<option value="0" @if(old('form') == 'work') @if(old('warranty') == 0) selected @endif @endif>Tidak</option>
|
||||
</select>
|
||||
@if(old('form') == 'work')
|
||||
@error('warranty')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="text" name="date" id="date-work" required class="form-control @if(old('form') == 'work') @error('date') is-invalid @enderror @endif" placeholder="Tanggal Pekerjaan">
|
||||
@if(old('form') == 'work')
|
||||
@error('date')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mt-4">
|
||||
<select name="user_sa_id" class="form-control @if(old('form') == 'work') @error('user_sa_id') is-invalid @enderror @endif">
|
||||
<option value="" selected>Service Advisor</option>
|
||||
@foreach ($user_sas as $user_sa)
|
||||
<option @if(old('form') == 'work') @if($user_sa->id == old('user_sa_id')) selected @enderror @endif value="{{ $user_sa->id }}">{{ $user_sa->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('user_sa_id')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
<input type="hidden" name="category" value="work">
|
||||
<div class="work_multirow">
|
||||
@if (old('work_id') && old('form') == 'work')
|
||||
{{-- @php
|
||||
dd($errors->all());
|
||||
@endphp --}}
|
||||
<input type="hidden" class="work_field_counter" value="{{ count(old('work_id')) }}">
|
||||
@for ($i = 0; $i < count(old('work_id')); $i++)
|
||||
<div class="form-group row" id="work_field{{ $i+1 }}">
|
||||
<div class="col-6">
|
||||
<select name="work_id[]" id="work_work{{ $i+1 }}" class="form-control @error('work_id.'.$i)" is-invalid @enderror>
|
||||
<option selected disabled>Pekerjaan</option>
|
||||
@foreach ($work_works as $work)
|
||||
<option value="{{ $work->id }}" @if($work->id == old('work_id.'.$i)) selected @endif>{{ $work->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
@error('work_id.'.$i)
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="number" class="form-control @error('quantity.'.$i) is-invalid @enderror" value="{{ old('quantity.'.$i) }}" name="quantity[]" placeholder="Qty">
|
||||
@error('quantity.'.$i)
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-danger work-btn-remove float-right" style="width: 100%;" type="button" id="workRemove1" onclick="removeFormField('work', 1)">X</button>
|
||||
</div>
|
||||
</div>
|
||||
@endfor
|
||||
@else
|
||||
<input type="hidden" class="work_field_counter" value="5">
|
||||
<div class="form-group row" id="work_field1">
|
||||
<div class="col-6">
|
||||
<select name="work_id[]" id="work_work1" class="form-control">
|
||||
<option selected disabled>Pekerjaan</option>
|
||||
@foreach ($work_works as $work)
|
||||
<option value="{{ $work->id }}">{{ $work->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="number" class="form-control" name="quantity[]" placeholder="Qty">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-danger work-btn-remove float-right" style="width: 100%;" type="button" id="workRemove1" onclick="removeFormField('work', 1)">X</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id="work_field2">
|
||||
<div class="col-6">
|
||||
<select name="work_id[]" id="work_work2" class="form-control">
|
||||
<option selected disabled>Pekerjaan</option>
|
||||
@foreach ($work_works as $work)
|
||||
<option value="{{ $work->id }}">{{ $work->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="number" class="form-control" name="quantity[]" placeholder="Qty">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-danger work-btn-remove float-right" style="width: 100%;" type="button" id="workRemove2" onclick="removeFormField('work', 2)">X</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id="work_field3">
|
||||
<div class="col-6">
|
||||
<select name="work_id[]" id="work_work3" class="form-control">
|
||||
<option selected disabled>Pekerjaan</option>
|
||||
@foreach ($work_works as $work)
|
||||
<option value="{{ $work->id }}">{{ $work->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="number" class="form-control" name="quantity[]" placeholder="Qty">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-danger work-btn-remove float-right" style="width: 100%;" type="button" id="workRemove3" onclick="removeFormField('work', 3)">X</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id="work_field4">
|
||||
<div class="col-6">
|
||||
<select name="work_id[]" id="work_work4" class="form-control">
|
||||
<option selected disabled>Pekerjaan</option>
|
||||
@foreach ($work_works as $work)
|
||||
<option value="{{ $work->id }}">{{ $work->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="number" class="form-control" name="quantity[]" placeholder="Qty">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-danger work-btn-remove float-right" style="width: 100%;" type="button" id="workRemove4" onclick="removeFormField('work', 4)">X</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id="work_field5">
|
||||
<div class="col-6">
|
||||
<select name="work_id[]" id="work_work5" class="form-control">
|
||||
<option selected disabled>Pekerjaan</option>
|
||||
@foreach ($work_works as $work)
|
||||
<option value="{{ $work->id }}">{{ $work->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="number" class="form-control" name="quantity[]" placeholder="Qty">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-danger work-btn-remove float-right" style="width: 100%;" type="button" id="workRemove5" onclick="removeFormField('work', 5)">X</button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-10"></div>
|
||||
<div class="col-2">
|
||||
<button class="btn mb-4 btn-sm btn-primary float-right btn-add-field-work" style="width: 100%;" onclick="addFormField('work'); return false;">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-brand button-save" style="display: block; width: 100%;">Simpan</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane @if(old('form') == 'wash') active @endif" id="wash" role="tabpanel">
|
||||
<form action="{{ route('transaction.store') }}" method="POST" id="washForm">
|
||||
@csrf
|
||||
<input type="hidden" name="form" value="wash">
|
||||
<input type="hidden" name="mechanic_id" value="{{ $mechanic->id }}">
|
||||
<input type="hidden" name="dealer_id" value="{{ $mechanic->dealer_id }}">
|
||||
<div class="form-group row">
|
||||
<div class="col-6">
|
||||
<input type="text" name="spk_no" class="form-control @if(old('form') == 'wash') @error('spk_no') is-invalid @enderror @endif" value="{{ old('spk_no') }}" placeholder="No. SPK">
|
||||
@if(old('form') == 'wash')
|
||||
@error('spk_no')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="text" name="police_number" class="form-control @if(old('form') == 'wash') @error('police_number') is-invalid @enderror @endif" value="{{ old('police_number') }}" placeholder="No. Polisi">
|
||||
@if(old('form') == 'wash')
|
||||
@error('police_number')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-6">
|
||||
<select name="warranty" class="form-control @if(old('form') == 'wash') @error('warranty') is-invalid @enderror @endif">
|
||||
<option selected>Warranty</option>
|
||||
<option value="1" @if(old('form') == 'wash') @if(old('warranty') == 1) selected @endif @endif>Ya</option>
|
||||
<option value="0" @if(old('form') == 'wash') @if(old('warranty') == 0) selected @endif @endif>Tidak</option>
|
||||
</select>
|
||||
@error('warranty')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="text" id="date-wash" name="date" class="form-control @if(old('form') == 'wash') @error('date') is-invalid @enderror @endif" placeholder="Tanggal Pekerjaan">
|
||||
@if(old('form') == 'wash')
|
||||
@error('date')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mt-4">
|
||||
<select name="user_sa_id" class="form-control @if(old('form') == 'wash') @error('user_sa_id') is-invalid @enderror @endif">
|
||||
<option selected>Service Advisor</option>
|
||||
@foreach ($user_sas as $user_sa)
|
||||
<option @if(old('form') == 'wash') @if($user_sa->id == old('user_sa_id')) selected @enderror @endif value="{{ $user_sa->id }}">{{ $user_sa->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@if(old('form') == 'wash')
|
||||
@error('user_sa_id')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{!! $message !!}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
@endif
|
||||
</div>
|
||||
<input type="hidden" name="category" value="work">
|
||||
<div class="form-group">
|
||||
<label>Pekerjaan</label>
|
||||
<input type="text" class="form-control" disabled value="{{ $wash_work->name }}">
|
||||
<input type="hidden" class="form-control" name="work_id[]" value="{{ $wash_work->id }}">
|
||||
<input type="hidden" class="form-control" name="quantity[]" value="1">
|
||||
</div>
|
||||
<button class="btn btn-brand button-save" style="display: block; width: 100%;">Simpan</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Portlet-->
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="ajax_work_url" value="{{ route('transaction.workcategory', ':id') }}">
|
||||
<input type="hidden" name="mechanic_id" value="{{ $mechanic->id }}">
|
||||
<input type="hidden" name="dealer_id" value="{{ $mechanic->dealer_id }}">
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('javascripts')
|
||||
<script>
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
function logout(event){
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Logout?',
|
||||
text: "Anda akan keluar dari sistem!",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#dedede',
|
||||
confirmButtonText: 'Logout'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$('#logout-form').submit();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function addFormField(form) {
|
||||
var id = $(`.${form}_field_counter`).val();
|
||||
id = parseInt(id) + 1;
|
||||
$(`
|
||||
<div class="form-group row" id="${form}_field${id}">
|
||||
<div class="col-6">
|
||||
<select name="${form}_work_id[]" id="${form}_work${id}" class="form-control">
|
||||
<option selected disabled>Pekerjaan</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="number" class="form-control" name="${form}_quantity[]" placeholder="Qty">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-danger" onclick="removeFormField('${form}', ${id})" style="width: 100%; opacity: 1;" id="remove${id}">X</button>
|
||||
</div>
|
||||
</div>
|
||||
`).insertBefore($(".btn-add-field-"+form).parent().parent());
|
||||
|
||||
let category_id = 1;
|
||||
if(form == 'wash') {
|
||||
category_id = 1;
|
||||
}else if(form == 'work') {
|
||||
category_id = 3;
|
||||
}
|
||||
|
||||
let ajax_work_url = $("input[name='ajax_work_url']").val()
|
||||
ajax_work_url = ajax_work_url.replace(':id', category_id);
|
||||
getWork(ajax_work_url, form, id)
|
||||
|
||||
if(id > 1) {
|
||||
$(".work-btn-remove").removeAttr('disabled')
|
||||
$(".work-btn-remove").removeClass("disabled")
|
||||
$(".work-btn-remove").css("opacity", "1")
|
||||
}
|
||||
|
||||
$(`.${form}_field_counter`).val(id);
|
||||
}
|
||||
|
||||
function removeFormField(form, id) {
|
||||
var attr = $(".work-btn-remove").attr('disabled');
|
||||
var id = $(`.${form}_field_counter`).val();
|
||||
if (typeof attr !== 'undefined' && attr !== false) {
|
||||
}else{
|
||||
id = parseInt(id) - 1;
|
||||
$(`.${form}_field_counter`).val(id);
|
||||
$(`#${form}_field${id}`).remove();
|
||||
}
|
||||
|
||||
|
||||
if(id < 2) {
|
||||
$(".work-btn-remove").attr("disabled", "disabled")
|
||||
$(".work-btn-remove").addClass("disabled")
|
||||
$(".work-btn-remove").css("opacity", "0.5")
|
||||
}
|
||||
}
|
||||
|
||||
function getWork(ajax_work_url, form, id) {
|
||||
$.get(ajax_work_url, function(res) {
|
||||
$.each(res.data, function (i, item) {
|
||||
$(`#${form}_work${id}`).append($('<option>', {
|
||||
value: item.id,
|
||||
text : item.name
|
||||
}));
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
$("#workForm").submit(function(e) {
|
||||
$(".button-save").attr("disabled");
|
||||
$(".button-save").addClass("disabled");
|
||||
return true;
|
||||
})
|
||||
|
||||
$("#washForm").submit(function(e) {
|
||||
$(".button-save").attr("disabled");
|
||||
$(".button-save").addClass("disabled");
|
||||
return true;
|
||||
})
|
||||
|
||||
$("#date-work").datepicker()
|
||||
$("#date-wash").datepicker()
|
||||
|
||||
function createTransaction(form) {
|
||||
let work_ids;
|
||||
if(form == 'work') {
|
||||
work_ids = $(`select[name='${form}_work_id[]']`).map(function (idx, elem) {
|
||||
return $(elem).val();
|
||||
}).get();
|
||||
}
|
||||
|
||||
if(form == 'wash') {
|
||||
work_ids = $(`input[name='${form}_work_id[]']`).map(function (idx, elem) {
|
||||
return $(elem).val();
|
||||
}).get();
|
||||
}
|
||||
|
||||
let quantities = $(`input[name='${form}_quantity[]']`).map(function (idx, elem) {
|
||||
return $(elem).val();
|
||||
}).get();
|
||||
|
||||
let datas = [];
|
||||
for(let i = 0; i < work_ids.length; i++) {
|
||||
const data = {
|
||||
user_id : $("input[name='mechanic_id']").val(),
|
||||
dealer_id : $("input[name='dealer_id']").val(),
|
||||
form : form,
|
||||
work_id : work_ids[i],
|
||||
qty : quantities[i],
|
||||
spk : $(`input[name='${form}_spk_no']`).val(),
|
||||
police_number : $(`input[name='${form}_police_number']`).val(),
|
||||
qtys : $(`input[name='${form}_quantity']`).val(),
|
||||
warranty : $(`select[name='${form}_warranty']`).val(),
|
||||
user_sa_id : $(`select[name='${form}_user_sa_id']`).val(),
|
||||
date : $(`input[name='${form}_date']`).val(),
|
||||
}
|
||||
datas.push(data)
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: $(`#${form}Form`).attr("action"),
|
||||
type: "POST",
|
||||
data: {
|
||||
data : datas
|
||||
},
|
||||
success: function(res) {
|
||||
document.location.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
400
resources/views/transaction/lists.blade.php
Normal file
400
resources/views/transaction/lists.blade.php
Normal file
@@ -0,0 +1,400 @@
|
||||
@extends('layouts.frontapp')
|
||||
@section('content')
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<div class="row mb-4 mt-4">
|
||||
<div class="col-4 my-auto">
|
||||
<a href="{{ route('transaction') }}" class="mt-4 btn btn-danger"><i class="fa fa-chevron-left"></i> Kembali</a>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
{{-- <h5 class="text-center mt-4">Cipta Kreasi Baru</h5> --}}
|
||||
<a href="/"><img src="{{ asset('logo-ckb.png') }}" style="width: 100%" alt="LOGO CKB"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kt-portlet">
|
||||
<div class="kt-portlet__head">
|
||||
<h5 class="mt-4">Laporan Harian</h5>
|
||||
</div>
|
||||
<div class="kt-portlet__body">
|
||||
<form action="{{ route('transaction.lists') }}" method="GET">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<label>Tgl Awal</label>
|
||||
<input type="date" name="date_start" id="date_start" value="{{ $date_start }}" class="form-control">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label>Tgl Akhir</label>
|
||||
<input type="date" name="date_end" id="date_end" value="{{ $date_end }}" class="form-control">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-success mt-3 btn-block">Cari</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<p><button id="share" type="button" class="btn btn-info btn-block mt-4">Bagikan Data Hari Ini</button></p>
|
||||
<p class="result"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
{{-- <div class="table-responsive">
|
||||
<table class="table table-striped" id="kt-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tanggal</th>
|
||||
<th>SPK</th>
|
||||
<th>SA</th>
|
||||
<th>No. Polisi</th>
|
||||
<th>Warranty</th>
|
||||
<th>Kategori</th>
|
||||
<th>Pekerjaan</th>
|
||||
<th>Qty</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($transaction_dealers as $transaction)
|
||||
<tr>
|
||||
<td>{{ date('d/m/Y', strtotime($transaction->date)) }}</td>
|
||||
<td>{{ $transaction->spk }}</td>
|
||||
<td>{{ $transaction->sa_name }}</td>
|
||||
<td>{{ $transaction->police_number }}</td>
|
||||
<td>{{ $transaction->warranty == 1 ? 'Ya' : 'Tidak' }}</td>
|
||||
<td>{{ $transaction->category_name }}</td>
|
||||
<td>{{ $transaction->workname }}</td>
|
||||
<td>{{ $transaction->qty }}</td>
|
||||
<td>
|
||||
@if ($transaction->status == 1)
|
||||
<span class="badge badge-success">Closed</span>
|
||||
@else
|
||||
<button class="btn btn-sm btn-warning btn-bold" data-action="{{ route('transaction.update', $transaction->transaction_id) }}" data-url="{{ route('transaction.edit', $transaction->transaction_id) }}" onclick="editTransaction({{ $transaction->transaction_id }})" id="editTransaction{{ $transaction->transaction_id }}">Edit</button>
|
||||
<br><br>
|
||||
<a class="btn btn-danger btn-sm btn-bold" href="{{ route('transaction.destroy', $transaction->transaction_id) }}"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('destroy-form').submit();">
|
||||
{{ __('Hapus') }}
|
||||
</a>
|
||||
|
||||
<form id="destroy-form" action="{{ route('transaction.destroy', $transaction->transaction_id) }}" method="POST" class="d-none">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> --}}
|
||||
@foreach ($transaction_dealers as $transaction)
|
||||
<div class="col-12">
|
||||
<div class="kt-portlet kt-portlet--mobile">
|
||||
<div class="kt-portlet__body">
|
||||
<div class="row">
|
||||
<div class="col-6 text-left">
|
||||
<b class="font-weight-bold text-info">{{ $transaction->spk }}</b>
|
||||
</div>
|
||||
<div class="col-6 text-right text-danger">
|
||||
<small>{{ $transaction->warranty == 1 ? 'Ada' : 'Tidak Ada' }}</small><br>
|
||||
<b class="font-weight-bold">Warranty</b>
|
||||
</div>
|
||||
</div><br>
|
||||
<div class="row">
|
||||
<div class="col-6 text-left text-dark">
|
||||
<b class="font-weight-bold">{{ $transaction->sa_name }}</b><br>
|
||||
<span class="kt-shape-font-color-4 text-dark">{{ $transaction->police_number }}</span>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<b class="font-weight-bold text-primary">{{ $transaction->workname }}</b><br>
|
||||
<b class="font-weight-bold text-dark">x{{ $transaction->qty }}</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kt-portlet__foot text-right mt-4" style="background: none !important; padding-right: 0 !important; padding-left: 0 !important; padding-bottom: 0; margin-bottom: 0;">
|
||||
@if ($transaction->status == 1)
|
||||
<span class="badge badge-success">Closed</span>
|
||||
@else
|
||||
<button class="btn btn-sm btn-pill btn-outline-warning btn-bold" data-action="{{ route('transaction.update', $transaction->transaction_id) }}" data-url="{{ route('transaction.edit', $transaction->transaction_id) }}" onclick="editTransaction({{ $transaction->transaction_id }})" id="editTransaction{{ $transaction->transaction_id }}">Edit</button>
|
||||
<a class="btn btn-pill btn-outline-danger btn-sm btn-bold" href="{{ route('transaction.destroy', $transaction->transaction_id) }}"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('destroy-form').submit();">
|
||||
{{ __('Hapus') }}
|
||||
</a>
|
||||
|
||||
<form id="destroy-form" action="{{ route('transaction.destroy', $transaction->transaction_id) }}" method="POST" class="d-none">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- <div class="col-12 mb-3">
|
||||
<div class="card card-body">
|
||||
<div class="row">
|
||||
<div class="col-6 text-left">
|
||||
<b>{{ date('d/m/Y', strtotime($transaction->date)) }}</b>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<p>{{ $transaction->spk }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<h5>{{ $transaction->workname }} | {{ $transaction->police_number }}</h5>
|
||||
<b>{{ $transaction->sa_name }}</b><br>
|
||||
<span>Warranty : <b>{{ $transaction->warranty == 1 ? 'YA' : 'TIDAK' }}</b></span>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<h3 class="font-weight-bold mb-4">1</h3>
|
||||
@if ($transaction->status == 1)
|
||||
<span class="badge badge-success">Closed</span>
|
||||
@else
|
||||
<button class="btn btn-sm btn-warning btn-bold" data-action="{{ route('transaction.update', $transaction->transaction_id) }}" data-url="{{ route('transaction.edit', $transaction->transaction_id) }}" onclick="editTransaction({{ $transaction->transaction_id }})" id="editTransaction{{ $transaction->transaction_id }}">Edit</button>
|
||||
<a class="btn btn-danger btn-sm btn-bold" href="{{ route('transaction.destroy', $transaction->transaction_id) }}"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('destroy-form').submit();">
|
||||
{{ __('Hapus') }}
|
||||
</a>
|
||||
|
||||
<form id="destroy-form" action="{{ route('transaction.destroy', $transaction->transaction_id) }}" method="POST" class="d-none">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
@endforeach
|
||||
<div class="col-12">
|
||||
{{ $transaction_dealers->appends(request()->except('page'))->links("vendor/pagination/bootstrap-4")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--begin::Modal-->
|
||||
<div class="modal fade" id="transactionModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form id="transactionForm" data-form="store" class="kt-form">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="modalHeading"></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="kt-portlet__body">
|
||||
<div class="form-group">
|
||||
<label>SPK</label>
|
||||
<input type="text" class="form-control" id="spk" name="spk" placeholder="SPK" value="" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Tanggal</label>
|
||||
<input type="date" class="form-control" id="date" name="date" placeholder="Tanggal" value="" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>No. Polisi</label>
|
||||
<input type="text" class="form-control" id="police_number" name="police_number" placeholder="No. Polisi" value="" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Pekerjaan</label>
|
||||
<select name="work_id" id="work_id" class="form-control">
|
||||
@foreach ($works as $work)
|
||||
<option value="{{ $work->id }}">{{ $work->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Qty</label>
|
||||
<input type="number" class="form-control" id="qty" name="qty" placeholder="Qty" value="" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Warranty</label>
|
||||
<select name="warranty" id="warranty" class="form-control">
|
||||
<option value="1">Ya</option>
|
||||
<option value="0">Tidak</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Service Advisor</label>
|
||||
<select name="sa_id" id="sa_id" class="form-control">
|
||||
@foreach ($sas as $sa)
|
||||
<option value="{{ $sa->id }}">{{ $sa->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary" id="saveBtn" value="create">Simpan</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Modal-->
|
||||
|
||||
<div id="shareThis" style="display: none;">
|
||||
@php
|
||||
$string = "*[Laporan Harian Mekanik ]*\n";
|
||||
$string .= "*". Auth::user()->dealer->name ."*\n";
|
||||
$string .= "*". $transaction_mechanics['today_date'] ."*\n\n\n";
|
||||
foreach ($transaction_mechanics['data'] as $shortname => $trx) {
|
||||
$string .= $shortname."\n";
|
||||
$total_qty = 0;
|
||||
foreach ($trx['data'] as $item) {
|
||||
$total_qty += explode(':', $item)[1];
|
||||
$string .= $item."\n";
|
||||
}
|
||||
$string .= "*TOTAL".$total_qty."*\n\n";
|
||||
|
||||
$string .= $trx['total_title'];
|
||||
foreach ($trx['total_body'] as $total) {
|
||||
$string .= $total;
|
||||
}
|
||||
|
||||
$string .= $trx['total_total']."\n\n";
|
||||
}
|
||||
@endphp
|
||||
{!! $string !!}
|
||||
</div>
|
||||
|
||||
{{-- <div class="row">
|
||||
<div class="col-lg-5" style="width: 100%; text-align: center;">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Transaksi</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="#">
|
||||
<div class="form-group">
|
||||
<label for="#">User</label>
|
||||
<select name="#" id="#" class="form-control">
|
||||
<option value="1" selected>User 1</option>
|
||||
<option value="2">User 2</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">SPK</label>
|
||||
<input type="text" class="form-control" placeholder="SPK" name="spk">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">No. Polisi</label>
|
||||
<input type="text" class="form-control" placeholder="No. Polisi" name="nopol">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">Garansi</label>
|
||||
<input type="text" class="form-control" placeholder="Garansi" name="guarantee">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">Kategori Pekerjaan</label>
|
||||
<select name="#" id="#" class="form-control">
|
||||
<option value="1" selected>Cuci</option>
|
||||
<option value="2">Kategori 2</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">Pekerjaan</label>
|
||||
<select name="#" id="#" class="form-control">
|
||||
<option value="1" selected>Cuci</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">Qty</label>
|
||||
<input type="number" class="form-control" placeholder="Quantity" name="quantity">
|
||||
</div>
|
||||
<button class="btn btn-primary">Simpan Perubahan</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-7">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3></h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
@endsection
|
||||
|
||||
@section('javascripts')
|
||||
<script>
|
||||
$("#kt-table").DataTable()
|
||||
|
||||
const shareData = {
|
||||
title: 'Dealer',
|
||||
text: $("#shareThis").html()
|
||||
}
|
||||
|
||||
const btn = $('#share');
|
||||
const resultPara = $('.result');
|
||||
// Share must be triggered by "user activation"
|
||||
btn.click(async function() {
|
||||
try {
|
||||
await navigator.share(shareData)
|
||||
console.log('Dealer shared successfully')
|
||||
} catch(err) {
|
||||
console.log('Error: ' + err)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function editTransaction(id) {
|
||||
let form_action = $("#editTransaction"+id).attr("data-action")
|
||||
let edit_url = $("#editTransaction"+id).attr("data-url")
|
||||
$("#transactionModal").modal("show")
|
||||
$("#transactionForm").attr('action', form_action)
|
||||
$.get(edit_url, function(res) {
|
||||
$("#transactionForm select[name='sa_id'] option[value='"+ res.data.user_sa_id +"']").prop('selected', true);
|
||||
$("#transactionForm select[name='work_id'] option[value='"+ res.data.work_id +"']").prop('selected', true);
|
||||
$("#transactionForm select[name='dealer_id'] option[value='"+ res.data.dealer_id +"']").prop('selected', true);
|
||||
$("#transactionForm select[name='warranty'] option[value='"+ res.data.warranty +"']").prop('selected', true);
|
||||
$("#transactionForm input[name='spk']").val(res.data.spk)
|
||||
var d = new Date(res.data.date);
|
||||
var day = ("0" + d.getDate()).slice(-2);
|
||||
var month = ("0" + (d.getMonth() + 1)).slice(-2);
|
||||
|
||||
var date = d.getFullYear()+"-"+(month)+"-"+(day) ;
|
||||
$("#transactionForm input[name='date']").val(date)
|
||||
$("#transactionForm input[name='police_number']").val(res.data.police_number)
|
||||
$("#transactionForm input[name='qty']").val(res.data.qty)
|
||||
})
|
||||
}
|
||||
|
||||
$("#transactionForm").submit(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: $('#transactionForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#transactionForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#transactionModal").modal("hide")
|
||||
$('#transactionForm').trigger("reset")
|
||||
if(res.status == 200) {
|
||||
Swal.fire(
|
||||
'Ubah Data',
|
||||
'Data berhasil diubah'
|
||||
).then((result) => {
|
||||
document.location.reload()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
307
resources/views/transaction/lists.blade.php.old
Normal file
307
resources/views/transaction/lists.blade.php.old
Normal file
@@ -0,0 +1,307 @@
|
||||
@extends('layouts.frontapp')
|
||||
|
||||
@section('content')
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<div class="kt-portlet" style="background: none; box-shadow: none;margin-bottom: -10px;">
|
||||
<div class="kt-portlet__body">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<h5 class="mt-4">Laporan Harian</h5>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<h4 class="text-center mt-4">Cipta Kreasi Baru</h4>
|
||||
</div>
|
||||
<div class="col-4 text-right">
|
||||
<a href="{{ route('transaction') }}" class="float-right mt-4">Kembali</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kt-portlet" style="background: none; box-shadow: none;">
|
||||
<div class="kt-portlet__body">
|
||||
<form action="{{ route('transaction.lists') }}" method="GET">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<label>Tgl Awal</label>
|
||||
<input type="date" name="date_start" id="date_start" class="form-control">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label>Tgl Akhir</label>
|
||||
<input type="date" name="date_end" id="date_end" class="form-control">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-success mt-3 btn-block">Cari</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<p><button id="share" type="button" class="btn btn-info btn-block mt-4">Bagikan</button></p>
|
||||
<p class="result"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped" id="kt-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tanggal</th>
|
||||
<th>SPK</th>
|
||||
<th>SA</th>
|
||||
<th>No. Polisi</th>
|
||||
<th>Warranty</th>
|
||||
<th>Kategori</th>
|
||||
<th>Pekerjaan</th>
|
||||
<th>Qty</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($transaction_dealers as $transaction)
|
||||
<tr>
|
||||
<td>{{ date('d/m/Y', strtotime($transaction->date)) }}</td>
|
||||
<td>{{ $transaction->spk }}</td>
|
||||
<td>{{ $transaction->sa_name }}</td>
|
||||
<td>{{ $transaction->police_number }}</td>
|
||||
<td>{{ $transaction->warranty == 1 ? 'Ya' : 'Tidak' }}</td>
|
||||
<td>{{ $transaction->category_name }}</td>
|
||||
<td>{{ $transaction->workname }}</td>
|
||||
<td>{{ $transaction->qty }}</td>
|
||||
<td>
|
||||
@if ($transaction->status == 1)
|
||||
<span class="badge badge-success">Closed</span>
|
||||
@else
|
||||
<button class="btn btn-sm btn-warning btn-bold" data-action="{{ route('transaction.update', $transaction->transaction_id) }}" data-url="{{ route('transaction.edit', $transaction->transaction_id) }}" onclick="editTransaction({{ $transaction->transaction_id }})" id="editTransaction{{ $transaction->transaction_id }}">Edit</button>
|
||||
<br><br>
|
||||
<a class="btn btn-danger btn-sm btn-bold" href="{{ route('transaction.destroy', $transaction->transaction_id) }}"
|
||||
onclick="event.preventDefault();
|
||||
document.getElementById('destroy-form').submit();">
|
||||
{{ __('Hapus') }}
|
||||
</a>
|
||||
|
||||
<form id="destroy-form" action="{{ route('transaction.destroy', $transaction->transaction_id) }}" method="POST" class="d-none">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--begin::Modal-->
|
||||
<div class="modal fade" id="transactionModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form id="transactionForm" data-form="store" class="kt-form">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="modalHeading"></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="kt-portlet__body">
|
||||
<div class="form-group">
|
||||
<label>SPK</label>
|
||||
<input type="text" class="form-control" id="spk" name="spk" placeholder="SPK" value="" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Tanggal</label>
|
||||
<input type="date" class="form-control" id="date" name="date" placeholder="Tanggal" value="" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>No. Polisi</label>
|
||||
<input type="text" class="form-control" id="police_number" name="police_number" placeholder="No. Polisi" value="" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Pekerjaan</label>
|
||||
<select name="work_id" id="work_id" class="form-control">
|
||||
@foreach ($works as $work)
|
||||
<option value="{{ $work->id }}">{{ $work->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Qty</label>
|
||||
<input type="number" class="form-control" id="qty" name="qty" placeholder="Qty" value="" autocomplete="off" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Warranty</label>
|
||||
<select name="warranty" id="warranty" class="form-control">
|
||||
<option value="1">Ya</option>
|
||||
<option value="0">Tidak</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Service Advisor</label>
|
||||
<select name="sa_id" id="sa_id" class="form-control">
|
||||
@foreach ($sas as $sa)
|
||||
<option value="{{ $sa->id }}">{{ $sa->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary" id="saveBtn" value="create">Simpan</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Modal-->
|
||||
|
||||
<div id="shareThis" style="display: none;">
|
||||
{{ $mechanic->dealer_name }}
|
||||
{{ $mechanic->name }}
|
||||
@foreach ($transaction_mechanics as $date => $trxm)
|
||||
@foreach ($trxm as $item)
|
||||
{{ date('d/m/Y', strtotime($date)) }}/{{ $item['shortname'] }} : {{ $item['qty'] }}
|
||||
@endforeach
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{-- <div class="row">
|
||||
<div class="col-lg-5" style="width: 100%; text-align: center;">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Transaksi</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="#">
|
||||
<div class="form-group">
|
||||
<label for="#">User</label>
|
||||
<select name="#" id="#" class="form-control">
|
||||
<option value="1" selected>User 1</option>
|
||||
<option value="2">User 2</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">SPK</label>
|
||||
<input type="text" class="form-control" placeholder="SPK" name="spk">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">No. Polisi</label>
|
||||
<input type="text" class="form-control" placeholder="No. Polisi" name="nopol">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">Garansi</label>
|
||||
<input type="text" class="form-control" placeholder="Garansi" name="guarantee">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">Kategori Pekerjaan</label>
|
||||
<select name="#" id="#" class="form-control">
|
||||
<option value="1" selected>Cuci</option>
|
||||
<option value="2">Kategori 2</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">Pekerjaan</label>
|
||||
<select name="#" id="#" class="form-control">
|
||||
<option value="1" selected>Cuci</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="#">Qty</label>
|
||||
<input type="number" class="form-control" placeholder="Quantity" name="quantity">
|
||||
</div>
|
||||
<button class="btn btn-primary">Simpan Perubahan</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-7">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3></h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
@endsection
|
||||
|
||||
@section('javascripts')
|
||||
<script>
|
||||
|
||||
$("#kt-table").DataTable()
|
||||
|
||||
const shareData = {
|
||||
title: 'Dealer',
|
||||
text: $("#shareThis").html()
|
||||
}
|
||||
|
||||
const btn = $('#share');
|
||||
const resultPara = $('.result');
|
||||
// Share must be triggered by "user activation"
|
||||
btn.click(async function() {
|
||||
try {
|
||||
await navigator.share(shareData)
|
||||
console.log('Dealer shared successfully')
|
||||
} catch(err) {
|
||||
console.log('Error: ' + err)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function editTransaction(id) {
|
||||
let form_action = $("#editTransaction"+id).attr("data-action")
|
||||
let edit_url = $("#editTransaction"+id).attr("data-url")
|
||||
$("#transactionModal").modal("show")
|
||||
$("#transactionForm").attr('action', form_action)
|
||||
$.get(edit_url, function(res) {
|
||||
$("#transactionForm select[name='sa_id'] option[value='"+ res.data.user_sa_id +"']").prop('selected', true);
|
||||
$("#transactionForm select[name='work_id'] option[value='"+ res.data.work_id +"']").prop('selected', true);
|
||||
$("#transactionForm select[name='dealer_id'] option[value='"+ res.data.dealer_id +"']").prop('selected', true);
|
||||
$("#transactionForm select[name='warranty'] option[value='"+ res.data.warranty +"']").prop('selected', true);
|
||||
$("#transactionForm input[name='spk']").val(res.data.spk)
|
||||
var d = new Date(res.data.date);
|
||||
var day = ("0" + d.getDate()).slice(-2);
|
||||
var month = ("0" + (d.getMonth() + 1)).slice(-2);
|
||||
|
||||
var date = d.getFullYear()+"-"+(month)+"-"+(day) ;
|
||||
$("#transactionForm input[name='date']").val(date)
|
||||
$("#transactionForm input[name='police_number']").val(res.data.police_number)
|
||||
$("#transactionForm input[name='qty']").val(res.data.qty)
|
||||
})
|
||||
}
|
||||
|
||||
$("#transactionForm").submit(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: $('#transactionForm').attr("action"),
|
||||
type: 'POST',
|
||||
data: $('#transactionForm').serialize(),
|
||||
success: function(res) {
|
||||
$("#transactionModal").modal("hide")
|
||||
$('#transactionForm').trigger("reset")
|
||||
if(res.status == 200) {
|
||||
Swal.fire(
|
||||
'Ubah Data',
|
||||
'Data berhasil diubah'
|
||||
).then((result) => {
|
||||
document.location.reload()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
372
resources/views/transaction/recap.blade.php
Normal file
372
resources/views/transaction/recap.blade.php
Normal file
@@ -0,0 +1,372 @@
|
||||
@extends('layouts.frontapp')
|
||||
@section('styles')
|
||||
<style>
|
||||
.nav-link-tab {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.nav-link-tab.active {
|
||||
font-weight: normal !important;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTable td, .dataTables_wrapper .dataTable th {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* tr th:nth-child(1) {
|
||||
z-index: 99999;
|
||||
} */
|
||||
|
||||
</style>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<div class="row mb-4 mt-4">
|
||||
<div class="col-4 my-auto">
|
||||
<a href="{{ route('transaction') }}" class="mt-4 btn btn-danger"><i class="fa fa-chevron-left"></i> Kembali</a>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
{{-- <h5 class="text-center mt-4">Cipta Kreasi Baru</h5> --}}
|
||||
<a href=""><img src="{{ asset('logo-ckb.png') }}" style="width: 100%" alt="LOGO CKB"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kt-portlet kt-portlet--mobile" id="kt_blockui_datatable">
|
||||
<div class="kt-portlet__head">
|
||||
<h5 class="mt-4">Laporan Rekap</h5>
|
||||
</div>
|
||||
<div class="kt-portlet__body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<form action="{{ route('transaction.recap') }}" method="GET">
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<label>Bulan</label>
|
||||
<select name="month" id="month" class="form-control">
|
||||
<option value="01" @if($month == '01') selected @endif>Januari</option>
|
||||
<option value="02" @if($month == '02') selected @endif>Februari</option>
|
||||
<option value="03" @if($month == '03') selected @endif>Maret</option>
|
||||
<option value="04" @if($month == '04') selected @endif>April</option>
|
||||
<option value="05" @if($month == '05') selected @endif>Mei</option>
|
||||
<option value="06" @if($month == '06') selected @endif>Juni</option>
|
||||
<option value="07" @if($month == '07') selected @endif>Juli</option>
|
||||
<option value="08" @if($month == '08') selected @endif>Agustus</option>
|
||||
<option value="09" @if($month == '09') selected @endif>September</option>
|
||||
<option value="10" @if($month == '10') selected @endif>Oktober</option>
|
||||
<option value="11" @if($month == '11') selected @endif>November</option>
|
||||
<option value="12" @if($month == '12') selected @endif>Desember</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-5 col-12">
|
||||
<label for="year">Tahun</label>
|
||||
<input type="number" class="form-control" name="year" id="year" value="{{ $year }}">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<br>
|
||||
<button type="submit" class="btn btn-success mt-2 btn-block">Cari</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<p><button id="share" type="button" class="btn btn-info btn-block mt-4">Bagikan Data Bulan Ini</button></p>
|
||||
<p class="result"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kt-portlet kt-portlet--mobile" id="kt_blockui_datatable">
|
||||
<div class="kt-portlet__head kt-portlet__head--lg">
|
||||
<div class="kt-portlet__head-label">
|
||||
<h3 class="kt-portlet__head-title">
|
||||
Rekap per tanggal {{ $dealer->name }}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kt-portlet__body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="table-responsive">
|
||||
<!--begin: Datatable -->
|
||||
<table class="table" id="kt_table_date">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" style="width: 18%; z-index: 99;">Tanggal</th>
|
||||
<th colspan="{{ $works_count }}" class="text-center">Pekerjaan</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach ($works as $work)
|
||||
<th>{{ $work->name }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (count($month_trxs))
|
||||
@foreach ($month_trxs as $trx)
|
||||
<tr>
|
||||
<td>{{ $trx['date'] }}</td>
|
||||
@foreach ($trx['works'] as $item)
|
||||
<td>{{ $item['qty'] }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">Tidak Ada Data</td>
|
||||
</tr>
|
||||
@endif
|
||||
{{-- <tr>
|
||||
<td>Pt B</td>
|
||||
<td>2</td>
|
||||
<td>9</td>
|
||||
<td>9</td>
|
||||
<td><a href="#" class="btn btn-info btn-sm">Detail</a></td>
|
||||
</tr> --}}
|
||||
</tbody>
|
||||
<tfoot style="background: rgba(93, 120, 255, .2) !important;">
|
||||
<tr>
|
||||
<th style="background: rgba(93, 120, 255, .2) !important;">
|
||||
<p>Total Bulan Ini</p><hr>
|
||||
<p>Total Bulan Kemarin</p>
|
||||
</th>
|
||||
@foreach ($totals as $total)
|
||||
<th style="background: rgba(93, 120, 255, .2) !important;">
|
||||
<p>{{ $total['now'] }} @if($total['now'] > $total['prev']) <i class="ml-3 fa fa-caret-up text-success"></i> @else <i class="ml-3 fa fa-caret-down text-danger"></i> @endif</p><hr>
|
||||
<p>{{ $total['prev'] }}</p>
|
||||
</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<!--end: Datatable -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kt-portlet kt-portlet--mobile" id="kt_blockui_datatable">
|
||||
<div class="kt-portlet__head kt-portlet__head--lg">
|
||||
<div class="kt-portlet__head-label">
|
||||
<h3 class="kt-portlet__head-title">
|
||||
Rekap per SA {{ $dealer->name }}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kt-portlet__body">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-tab btn-primary text-light active" data-toggle="tab" href="#kt_tabs_1_2"><i class="flaticon2-pie-chart-4 text-light"></i> Diagram</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link nav-link-tab btn-primary text-light" data-toggle="tab" href="#" data-target="#kt_tabs_1_1"><i class="flaticon-squares-1 text-light"></i> Tabel</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="kt_tabs_1_2" role="tabpanel">
|
||||
<div><canvas id="sa-chart"></canvas></div>
|
||||
</div>
|
||||
<div class="tab-pane" id="kt_tabs_1_1" role="tabpanel">
|
||||
<!--begin: Datatable -->
|
||||
<div class="table-responsive">
|
||||
<table class="table" id="kt_table_dealer">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" style="z-index: 99;">SA</th>
|
||||
<th colspan="{{ $works_count }}" class="text-center">Pekerjaan</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach ($works as $work)
|
||||
<th>{{ $work->name }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (count($trxs))
|
||||
@foreach ($trxs as $trx)
|
||||
<tr>
|
||||
<td>{{ $trx['sa_name'] }}</td>
|
||||
@foreach ($trx['works'] as $item)
|
||||
<td>{{ $item['qty'] }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">Tidak Ada Data</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--end: Datatable -->
|
||||
{{-- <div class="table-responsive">
|
||||
</div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<textarea id="shareThis" style="display: none;">
|
||||
@php
|
||||
$string = "\n*[Laporan SA ". $dealer->name ." ]*\n";
|
||||
$string .= "*[".$share['today_date']." ]*\n\n";
|
||||
$sum_today_trx = 0;
|
||||
|
||||
foreach ($share['today_trxs'] as $trx) {
|
||||
$string .= $trx->name.":".$trx->qty;
|
||||
$sum_today_trx += $trx->qty;
|
||||
}
|
||||
|
||||
$string .= "\n";
|
||||
$string .= "*TOTAL : ".$sum_today_trx." Unit*\n\n";
|
||||
$string .= "*[PERIODE 1 - ". $share['today_date'] ."]*\n\n";
|
||||
|
||||
$sum_this_month_trx = 0;
|
||||
foreach ($share['this_month_trxs'] as $trx) {
|
||||
$string .= $trx->name ." : ". $trx->qty ." Unit\n";
|
||||
$sum_this_month_trx += $trx->qty;
|
||||
}
|
||||
$string .= "\n\n*TOTAL : ".$sum_this_month_trx." Unit*"
|
||||
@endphp
|
||||
|
||||
{!! $string !!}
|
||||
</textarea>
|
||||
|
||||
@endsection
|
||||
@section('javascripts')
|
||||
<script>
|
||||
const shareData = {
|
||||
title: 'Dealer',
|
||||
text: $("#shareThis").val().replaceAll("\\n", "\n")
|
||||
}
|
||||
|
||||
const btn = $('#share');
|
||||
const resultPara = $('.result');
|
||||
// Share must be triggered by "user activation"
|
||||
btn.click(async function() {
|
||||
console.log($("#shareThis").val())
|
||||
try {
|
||||
await navigator.share(shareData)
|
||||
console.log('Dealer shared successfully')
|
||||
} catch(err) {
|
||||
console.log('Error: ' + err)
|
||||
}
|
||||
})
|
||||
|
||||
$("#kt_table_date").DataTable({
|
||||
paging: false,
|
||||
// scrollY: "true",
|
||||
// scrollX: true,
|
||||
// scrollCollapse: true,
|
||||
fixedColumns: {
|
||||
left: 1
|
||||
}
|
||||
})
|
||||
|
||||
$("#kt_table_dealer").DataTable({
|
||||
paging: false,
|
||||
// scrollY: "300px",
|
||||
// scrollX: true,
|
||||
// scrollCollapse: true,
|
||||
fixedColumns: {
|
||||
left: 1
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function random_rgba(alpha) {
|
||||
var o = Math.round, r = Math.random, s = 255;
|
||||
return 'rgba(' + o(r()*s) + ',' + o(r()*s) + ',' + o(r()*s) + ','+ alpha +')';
|
||||
}
|
||||
|
||||
let labels = JSON.parse('{{ $sa_names }}'.replace(/("\;)/g,"\""));
|
||||
let labels2 = []
|
||||
labels.forEach(function(label) {
|
||||
if (/\s/.test(label)) {
|
||||
labels2.push(label.split(" "))
|
||||
}else{
|
||||
labels2.push(label)
|
||||
}
|
||||
})
|
||||
|
||||
const trx_data = JSON.parse('{{ $trx_data }}'.replace(/("\;)/g,"\""));
|
||||
let trxs = []
|
||||
trx_data.forEach(trx => {
|
||||
let data = {
|
||||
label : trx['work_name'],
|
||||
data: trx[['qty']],
|
||||
fill: false,
|
||||
backgroundColor: random_rgba(0.2),
|
||||
borderColor: random_rgba(1),
|
||||
borderWidth: 1
|
||||
}
|
||||
|
||||
trxs.push(data)
|
||||
});
|
||||
|
||||
const data = {
|
||||
labels: labels2,
|
||||
datasets: trxs
|
||||
};
|
||||
|
||||
if(labels2.length && trxs.length) {
|
||||
new Chart($("#sa-chart"), {
|
||||
type: 'bar',
|
||||
data: data,
|
||||
plugins: [ChartDataLabels],
|
||||
options: {
|
||||
indexAxis: 'y',
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
x: {
|
||||
position: 'top',
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: true,
|
||||
labels: {
|
||||
color: 'rgb(255, 99, 132)'
|
||||
},
|
||||
position: 'top'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
$("#sa-chart").parent().height($("#sa-chart").parent().height() + 500)
|
||||
}else{
|
||||
$("#sa-chart").parent().append(`
|
||||
<div class="alert" role="alert">
|
||||
<div class="alert-text">
|
||||
<h4 class="alert-heading">Data Kosong!</h4>
|
||||
<p>Belum ada data pekerjaan masuk</p>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
`)
|
||||
$("#sa-chart").parent().css('height', '100%')
|
||||
$("#sa-chart").remove()
|
||||
}
|
||||
|
||||
$(".nav-link-tab.active").removeClass('btn-primary')
|
||||
$(".nav-link-tab.active").removeClass('text-light')
|
||||
$(".nav-link-tab.active i").toggleClass('text-light')
|
||||
$(".nav-link-tab").parent().click(function() {
|
||||
$(".nav-link-tab").toggleClass('btn-primary')
|
||||
$(".nav-link-tab").toggleClass('text-light')
|
||||
$(".nav-link-tab i").toggleClass('text-light')
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
168
resources/views/transaction/recap_old.blade.php
Normal file
168
resources/views/transaction/recap_old.blade.php
Normal file
@@ -0,0 +1,168 @@
|
||||
@extends('layouts.frontapp')
|
||||
|
||||
@section('content')
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<div class="kt-portlet" style="background: none; box-shadow: none;margin-bottom: -10px;">
|
||||
<div class="kt-portlet__body">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<h5 class="text-left mt-4">Laporan Rekap</h5>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<h4 class="text-center mt-4">Cipta Kreasi Baru</h4>
|
||||
</div>
|
||||
<div class="col-4 text-right">
|
||||
<a href="{{ route('transaction') }}" class="float-right mt-4">Kembali</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="kt-portlet kt-portlet--mobile" id="kt_blockui_datatable">
|
||||
<div class="kt-portlet__head kt-portlet__head--lg">
|
||||
<div class="kt-portlet__head-label">
|
||||
<h3 class="kt-portlet__head-title">
|
||||
Rekap per tanggal {{ $dealer->name }}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kt-portlet__body">
|
||||
<form action="{{ route('transaction.recap') }}" method="GET">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<label>Tgl Awal</label>
|
||||
<input type="date" name="date_start" id="date_start" class="form-control">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label>Tgl Akhir</label>
|
||||
<input type="date" name="date_end" id="date_end" class="form-control">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-success mt-3 btn-block">Cari</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<p><button id="share" type="button" class="btn btn-info btn-block mt-4">Bagikan</button></p>
|
||||
<p class="result"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="table-responsive">
|
||||
<!--begin: Datatable -->
|
||||
<table class="table table-striped table-bordered table-hover table-checkable" id="kt_table_date">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2">Tanggal</th>
|
||||
<th colspan="{{ $works_count }}" class="text-center">Pekerjaan</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach ($works as $work)
|
||||
<th>{{ $work->name }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($trxs as $date => $trx)
|
||||
<tr>
|
||||
<td>{{ date('d/m/Y', strtotime($date)) }}</td>
|
||||
@foreach ($trx['works'] as $item)
|
||||
<td>{{ $item['qty'] }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- <tr>
|
||||
<td>Pt B</td>
|
||||
<td>2</td>
|
||||
<td>9</td>
|
||||
<td>9</td>
|
||||
<td><a href="#" class="btn btn-info btn-sm">Detail</a></td>
|
||||
</tr> --}}
|
||||
</tbody>
|
||||
</table>
|
||||
<!--end: Datatable -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kt-portlet kt-portlet--mobile" id="kt_blockui_datatable">
|
||||
<div class="kt-portlet__head kt-portlet__head--lg">
|
||||
<div class="kt-portlet__head-label">
|
||||
<h3 class="kt-portlet__head-title">
|
||||
Rekap per SA {{ $dealer->name }}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kt-portlet__body">
|
||||
<div class="table-responsive">
|
||||
<!--begin: Datatable -->
|
||||
<table class="table table-striped table-bordered table-hover table-checkable" id="kt_table_dealer">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2">SA</th>
|
||||
<th colspan="{{ $works_count }}" class="text-center">Pekerjaan</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach ($works as $work)
|
||||
<th>{{ $work->name }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($dealer_trxs as $sa => $trx)
|
||||
<tr>
|
||||
<td>{{ $sa }}</td>
|
||||
@foreach ($trx['works'] as $item)
|
||||
<td>{{ $item['qty'] }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<!--end: Datatable -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="shareThis" style="display: none;">
|
||||
{{ $mechanic->dealer_name }}
|
||||
{{ $mechanic->name }}
|
||||
@foreach ($sharedw as $date => $trxm)
|
||||
@foreach ($trxm as $item)
|
||||
{{ date('d/m/Y', strtotime($date)) }}/{{ $item['shortname'] }} : {{ $item['qty'] }}
|
||||
@endforeach
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@section('javascripts')
|
||||
<script>
|
||||
const shareData = {
|
||||
title: 'Dealer',
|
||||
text: $("#shareThis").html()
|
||||
}
|
||||
|
||||
const btn = $('#share');
|
||||
const resultPara = $('.result');
|
||||
// Share must be triggered by "user activation"
|
||||
btn.click(async function() {
|
||||
try {
|
||||
await navigator.share(shareData)
|
||||
console.log('Dealer shared successfully')
|
||||
} catch(err) {
|
||||
console.log('Error: ' + err)
|
||||
}
|
||||
})
|
||||
|
||||
$("#kt_table_date").DataTable()
|
||||
$("#kt_table_dealer").DataTable()
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user