-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update menu item name and invoice status labels
- Loading branch information
1 parent
63eadbb
commit d5d1e72
Showing
10 changed files
with
1,086 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,5 @@ yarn-error.log | |
/public/assets/js | ||
/public/assets/css | ||
/public/assets/vendor | ||
.env | ||
.env | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace App\Exports; | ||
|
||
use App\Enums\BillStatus; | ||
use App\Enums\PaymentMethod; | ||
use App\Models\Bill; | ||
use Carbon\Carbon; | ||
use Illuminate\Support\Facades\Date; | ||
use Maatwebsite\Excel\Concerns\FromCollection; | ||
use Maatwebsite\Excel\Concerns\WithHeadings; | ||
use Maatwebsite\Excel\Concerns\WithMapping; | ||
|
||
class BillExport implements FromCollection, WithHeadings, WithMapping | ||
{ | ||
public $bills; | ||
|
||
public function __construct($bills) | ||
{ | ||
$this->bills = $bills; | ||
} | ||
|
||
public function collection() | ||
{ | ||
return Bill::query() | ||
->with(['customer', 'plan', 'payment']) | ||
->whereIn('id', $this->bills)->get(); | ||
} | ||
|
||
/** | ||
* @param Bill $bill | ||
*/ | ||
public function map($bill): array | ||
{ | ||
return [ | ||
$bill->customer->id, | ||
$bill->customer->customer_name, | ||
$bill->plan->name, | ||
$bill->plan->price, | ||
Date::parse($bill->dude_date)->format('F Y'), | ||
$bill->discount ?? 0, | ||
$bill->tax_rate, | ||
$bill->total_amount, | ||
$bill->status == BillStatus::PAID ? 'Lunas' : 'Belum Lunas', | ||
$bill->payment?->payment_date ?? '-', | ||
$bill->payment?->method == PaymentMethod::CASH ? 'Tunai' : 'Midtrans', | ||
]; | ||
} | ||
|
||
public function headings(): array | ||
{ | ||
return [ | ||
'Nomor Pelanggan', | ||
'Nama', | ||
'Paket', | ||
'Tarif', | ||
'Tagihan', | ||
'Diskon', | ||
'PPN', | ||
'Total', | ||
'Status', | ||
'Tanggal Pembayaran', | ||
'Metode', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace App\Exports; | ||
|
||
use App\Models\Customer; | ||
use Maatwebsite\Excel\Concerns\FromCollection; | ||
use Maatwebsite\Excel\Concerns\WithHeadings; | ||
use Maatwebsite\Excel\Concerns\WithMapping; | ||
|
||
class CustomerExport implements FromCollection, WithMapping, WithHeadings | ||
{ | ||
public $customers; | ||
|
||
public function __construct($customers) | ||
{ | ||
$this->customers = $customers; | ||
} | ||
|
||
/** | ||
* @param Customer $customer | ||
*/ | ||
public function map($customer): array | ||
{ | ||
return [ | ||
$customer->id, | ||
$customer->customer_name, | ||
$customer->phone_number, | ||
$customer->address, | ||
$customer->installment_status->value, | ||
$customer->service_status->value, | ||
$customer->active_date, | ||
$customer->auto_isolir ? 'Ya' : 'Tidak', | ||
$customer->isolir_date, | ||
$customer->plan->name, | ||
]; | ||
} | ||
|
||
public function collection() | ||
{ | ||
return Customer::query() | ||
->with('plan') | ||
->whereIn('id', $this->customers)->get(); | ||
} | ||
|
||
public function headings(): array | ||
{ | ||
return [ | ||
'Nomor Pelanggan', | ||
'Nama', | ||
'Telepon', | ||
'Alamat', | ||
'Status Pemasangan', | ||
'Status Layanan', | ||
'Tanggal Aktif', | ||
'Auto Isolir', | ||
'Tanggal Isolir', | ||
'Paket', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.