Skip to content

Commit

Permalink
Merge branch 'release/alpha-1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bangyadiii committed Aug 10, 2024
2 parents 3c2bf7f + 35166af commit 3a0eb04
Show file tree
Hide file tree
Showing 412 changed files with 36,585 additions and 35,610 deletions.
22 changes: 20 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
APP_NAME=Laravel
APP_NAME='ISP Management System'
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=id

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
Expand All @@ -17,7 +18,7 @@ DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
FILESYSTEM_DISK=public
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
Expand All @@ -28,6 +29,8 @@ REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

TELESCOPE_ENABLED=false

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
Expand All @@ -53,3 +56,18 @@ PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

WABLAS_TOKEN=
WABLAS_SERVER=

MIDTRANS_CLIENT_KEY=
MIDTRANS_SERVER_KEY=
MIDTRANS_SB_CLIENT_KEY=
MIDTRANS_SB_SERVER_KEY=
MIDTRANS_IS_PRODUCTION=

SENTRY_LARAVEL_DSN=null # null to disabled reporting to sentry.
SENTRY_RELEASE=
SENTRY_ENVIRONMENT=local

ROUTER_OS_PORT=8730
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ yarn-error.log
/public/assets/js
/public/assets/css
/public/assets/vendor
.env
.env
composer.lock
4 changes: 4 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
14 changes: 14 additions & 0 deletions IntelephenseHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Illuminate\Contracts\View;

use Illuminate\Contracts\Support\Renderable;

interface View extends Renderable
{
/** @return static */
public function extends(string $layout);
public function layoutData();
public function layout(string $layout);
//any other method that throws false error here :)
}
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
- Venda NET
# ISP Management System - VENDA NET

ISP Management System ini dikembangkan untuk VENDA NET, sebuah penyedia layanan internet RT/RW yang memiliki fitur-fitur utama sebagai berikut:

## Features

1. **Manajemen Pelanggan**:

- Tambah, edit, dan hapus data pelanggan.
- **Integrasi dengan Mikrotik**: Setiap kali data pelanggan ditambahkan, sistem secara otomatis menambahkan `PPPoE Secret` ke Mikrotik.

2. **Manajemen Paket Data**:

- Tambah, edit, dan hapus data paket internet.
- **Integrasi dengan Mikrotik**: Setiap kali data paket ditambahkan, sistem secara otomatis menambahkan `PPPoE Profile` ke Mikrotik.

3. **Pembayaran**:

- **Integrasi dengan Midtrans**: Pembayaran tagihan internet dilakukan melalui payment gateway Midtrans, memastikan proses pembayaran yang aman dan mudah bagi pelanggan.

4. **Notifikasi Billing**:
- **Integrasi dengan WABLAS**: Sistem mengirimkan notifikasi tagihan kepada pelanggan melalui WhatsApp menggunakan layanan WABLAS, memastikan pelanggan mendapatkan informasi tagihan tepat waktu.

## Instalation

1. **Clone Repository**:
```bash
git clone https://github.com/bangyadiii/venda-net
cd venda-net
```
2. **Install Depedencies**:
```bash
composer install
npm install
```
3. **Konfigurasi Environment**:
Salin file .env.example menjadi .env dan sesuaikan konfigurasi database, Mikrotik, Midtrans, dan WABLAS sesuai kebutuhan Anda.
```bash
cp .env.example.env
```
4. **Migrasi dan Seed Database**:
```bash
php artisan migrate --seed
```
5. **Generate App Key**:
```bash
php artisan key:generate
```
6. Run the app:
```bash
php artisan serve
```

## Usage

Setelah aplikasi berjalan, Anda dapat mengakses antarmuka melalui http://localhost:8000. Masuk dengan kredensial admin yang telah diatur selama proses seeding.

## Mikrotik Integration

- Tambahkan pelanggan baru melalui menu Manajemen Pelanggan dan `PPPoE Secret` akan otomatis ditambahkan ke Mikrotik.
- Tambahkan paket data baru melalui menu Manajemen Paket Data dan `PPPoE Profile` akan otomatis ditambahkan ke Mikrotik.

## Midtrans Payment Integration

- Pembayaran dilakukan melalui gateway Midtrans. Pastikan Anda telah mengonfigurasi `MIDTRANS_SERVER_KEY` dan `MIDTRANS_CLIENT_KEY` di file `.env.`

## WABLAS Notification Integration

- Sistem akan mengirimkan notifikasi tagihan secara otomatis melalui WhatsApp menggunakan layanan WABLAS. Pastikan Anda telah mengonfigurasi `WABLAS_API_KEY` di file `.env`.
52 changes: 52 additions & 0 deletions app/Classes/Invoice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace App\Classes;

use Carbon\CarbonInterface;
use LaravelDaily\Invoices\Invoice as LaravelDailyInvoice;

class Invoice extends LaravelDailyInvoice
{
/**
* @var CarbonInterface
*/
public $dueDate;

/**
* @var CarbonInterface
*/
public $paidDate;

/**
* @var CarbonInterface
*/
public $periode;

public function __construct()
{
parent::__construct();
$this->dueDate = $this->date;
}

public function dueDate(CarbonInterface $dueDate)
{
$this->dueDate = $dueDate;
return $this;
}

public function getDueDate()
{
return $this->dueDate->format($this->date_format);
}

public function paidDate(CarbonInterface $paidDate)
{
$this->paidDate = $paidDate;
return $this;
}

public function getPaidDate()
{
return $this->paidDate?->toDateTimeString() ?? null;
}
}
38 changes: 38 additions & 0 deletions app/Console/Commands/CheckLatePayments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace App\Console\Commands;

use App\Enums\BillStatus;
use App\Enums\ServiceStatus;
use Illuminate\Console\Command;
use App\Models\Customer;
use App\Jobs\IsolirCustomerJob;
use Carbon\Carbon;

class CheckLatePayments extends Command
{
protected $signature = 'app:late-payments';
protected $description = 'Check for customers with late payments and suspend their service';

public function handle()
{
/** @var \Illuminate\Database\Eloquent\Collection $customers */
$customers = Customer::query()
->where('service_status', ServiceStatus::ACTIVE)
->whereHas('bills', function ($query) {
$query
->where('status', BillStatus::UNPAID)
->where('due_date', '<', Carbon::now());
})->get();
if ($customers->isEmpty()) {
$this->info('No customers with late payments found');
return Command::SUCCESS;
}

foreach ($customers as $customer) {
\dispatch(new IsolirCustomerJob($customer));
}

return Command::SUCCESS;
}
}
65 changes: 65 additions & 0 deletions app/Console/Commands/CreateAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace App\Console\Commands;

use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;

class CreateAdmin extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:create-admin {--default}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Creating an admin user.';

/**
* Execute the console command.
*/
public function handle()
{
if ($this->option('default')) {
User::updateOrCreate([
'username' => 'admin',
], [
'name' => 'Admin',
'password' => Hash::make('password'),
]);
$this->info('Default admin user created successfully!');
return Command::SUCCESS;
}

$pwd = $this->secret('To create an admin user, you need to enter the password. Enter the password to continue.');
if ($pwd !== 'PASSWORD###') {
$this->error('Invalid password!');
return Command::FAILURE;
}

$name = $this->ask('Enter your name', 'Admin');
$username = $this->ask('Enter your username', 'admin');
$password = $this->secret('Enter your password', 'password');

if (User::where('username', $username)->exists()) {
$this->error('User already exists!');
return Command::FAILURE;
}

$admin = new User();
$admin->name = $name;
$admin->username = $username;
$admin->password = Hash::make($password);
$admin->save();

$this->info('Admin user created successfully!');
return Command::SUCCESS;
}
}
45 changes: 45 additions & 0 deletions app/Console/Commands/GenerateMonthlyBill.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace App\Console\Commands;

use App\Enums\ServiceStatus;
use App\Jobs\GenerateMonthlyBills;
use App\Models\Customer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class GenerateMonthlyBill extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:generate-monthly-bill';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';

/**
* Execute the console command.
*/
public function handle()
{
$customers = Customer::with('plan')
->where('service_status', ServiceStatus::ACTIVE)
->whereDoesntHave('bills', function ($query) {
$query->where(DB::raw('MONTH(due_date)'), now()->month);
})
->get();
/**
* @var Customer $customer
*/
foreach ($customers as $customer) {
dispatch(new GenerateMonthlyBills($customer));
}
}
}
Loading

0 comments on commit 3a0eb04

Please sign in to comment.