Files
CKB/resources/views/transaction/recap_old.blade.php
2025-05-27 19:09:17 +07:00

168 lines
6.8 KiB
PHP

@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