Upload Project
This commit is contained in:
commit
322b65cd04
|
@ -0,0 +1,6 @@
|
||||||
|
deployment:
|
||||||
|
tasks:
|
||||||
|
- export DEPLOYPATH=/home/bimanetc/public_html
|
||||||
|
- /bin/cp -r * $DEPLOYPATH
|
||||||
|
- /bin/find $DEPLOYPATH -type d -exec chmod 755 {} \;
|
||||||
|
- /bin/find $DEPLOYPATH -type f -exec chmod 644 {} \;
|
|
@ -0,0 +1,130 @@
|
||||||
|
#-------------------------
|
||||||
|
# Operating Specific Junk Files
|
||||||
|
#-------------------------
|
||||||
|
|
||||||
|
# OS X
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# OS X Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
*~
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Linux trash folder which might appear on any partition or disk
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# Environment Files
|
||||||
|
#-------------------------
|
||||||
|
# These should never be under version control,
|
||||||
|
# as it poses a security risk.
|
||||||
|
node_modules/
|
||||||
|
public/uploads
|
||||||
|
.env
|
||||||
|
.vagrant
|
||||||
|
Vagrantfile
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# Temporary Files
|
||||||
|
#-------------------------
|
||||||
|
writable/cache/*
|
||||||
|
!writable/cache/index.html
|
||||||
|
|
||||||
|
writable/logs/*
|
||||||
|
!writable/logs/index.html
|
||||||
|
|
||||||
|
writable/session/*
|
||||||
|
!writable/session/index.html
|
||||||
|
|
||||||
|
writable/uploads/*
|
||||||
|
!writable/uploads/index.html
|
||||||
|
|
||||||
|
writable/debugbar/*
|
||||||
|
!writable/debugbar/.gitkeep
|
||||||
|
|
||||||
|
php_errors.log
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# User Guide Temp Files
|
||||||
|
#-------------------------
|
||||||
|
user_guide_src/build/*
|
||||||
|
user_guide_src/cilexer/build/*
|
||||||
|
user_guide_src/cilexer/dist/*
|
||||||
|
user_guide_src/cilexer/pycilexer.egg-info/*
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# Test Files
|
||||||
|
#-------------------------
|
||||||
|
tests/coverage*
|
||||||
|
|
||||||
|
# Don't save phpunit under version control.
|
||||||
|
phpunit
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# Composer
|
||||||
|
#-------------------------
|
||||||
|
vendor/
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# IDE / Development Files
|
||||||
|
#-------------------------
|
||||||
|
|
||||||
|
# Modules Testing
|
||||||
|
_modules/*
|
||||||
|
|
||||||
|
# phpenv local config
|
||||||
|
.php-version
|
||||||
|
|
||||||
|
# Jetbrains editors (PHPStorm, etc)
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
# Netbeans
|
||||||
|
nbproject/
|
||||||
|
build/
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
nbactions.xml
|
||||||
|
nb-configuration.xml
|
||||||
|
.nb-gradle/
|
||||||
|
|
||||||
|
# Sublime Text
|
||||||
|
*.tmlanguage.cache
|
||||||
|
*.tmPreferences.cache
|
||||||
|
*.stTheme.cache
|
||||||
|
*.sublime-workspace
|
||||||
|
*.sublime-project
|
||||||
|
.phpintel
|
||||||
|
/api/
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
/results/
|
||||||
|
/phpunit*.xml
|
||||||
|
public/uploads/1716271463_cff52da596a3f69e6109.jpg
|
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2019 British Columbia Institute of Technology
|
||||||
|
Copyright (c) 2019-2024 CodeIgniter Foundation
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
|
@ -0,0 +1,65 @@
|
||||||
|
# Proyek X
|
||||||
|
|
||||||
|
Deskripsi proyek.
|
||||||
|
|
||||||
|
## Instalasi dan Menjalankan CodeIgniter 4 (CI4)
|
||||||
|
|
||||||
|
1. **Unduh Proyek:**
|
||||||
|
- Clone repositori ini ke direktori lokal Anda.
|
||||||
|
|
||||||
|
3. **Konfigurasi:**
|
||||||
|
- Buka file `.env` dan atur konfigurasi database sesuai dengan pengaturan server Anda.
|
||||||
|
|
||||||
|
4. **Instalasi Dependensi:**
|
||||||
|
- Buka terminal atau command prompt, lalu navigasikan ke direktori proyek.
|
||||||
|
- Jalankan perintah berikut untuk menginstal dependensi:
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Jalankan Server Lokal:**
|
||||||
|
- Anda dapat menggunakan server bawaan PHP untuk menjalankan proyek CI4. Jalankan perintah berikut di terminal atau command prompt:
|
||||||
|
```
|
||||||
|
php spark serve
|
||||||
|
```
|
||||||
|
- Proyek Anda akan dijalankan pada alamat `http://localhost:8080`.
|
||||||
|
|
||||||
|
|
||||||
|
## Penggunaan
|
||||||
|
|
||||||
|
### Configurasi Tailwind CSS
|
||||||
|
|
||||||
|
1. **Jalankan Tailwind CSS dengan Mode Watch:**
|
||||||
|
- Buka terminal atau command prompt, dan jalankan perintah berikut:
|
||||||
|
```
|
||||||
|
npx tailwindcss -i public/assets/css/input.css -o public/assets/css/output.css --watch
|
||||||
|
```
|
||||||
|
- `styles.css`: Nama file CSS utama Anda.
|
||||||
|
- `output.css`: Nama file untuk hasil output.
|
||||||
|
- `--watch`: Opsi ini akan memantau perubahan pada file `styles.css` dan secara otomatis menghasilkan output `output.css` setiap kali ada perubahan.
|
||||||
|
|
||||||
|
2. **Penggunaan Tailwind CSS:**
|
||||||
|
- Gunakan Tailwind CSS di file CSS Anda dengan mengimpornya:
|
||||||
|
```css
|
||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-fitur admin
|
||||||
|
1.Ngga bisa delete akun akun pelanggan dan teknisi
|
||||||
|
|
||||||
|
2.waktu rekap transaksi tampilan kategori pembayarannya di excel ping, 'bulanan' dan 'instalasi baru'
|
||||||
|
|
||||||
|
3.aksi fitur laporan tidak ada yg berfungsi eror
|
||||||
|
|
||||||
|
-fitur user
|
||||||
|
1.setelah melakukan pembayaran bulanan status tetep 'belum bayar' padahal sukses
|
||||||
|
|
||||||
|
Ada bugnya pas waktu klik tambah biaya bulanan malah jadwal si A ada lagi ping
|
|
@ -0,0 +1,6 @@
|
||||||
|
<IfModule authz_core_module>
|
||||||
|
Require all denied
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !authz_core_module>
|
||||||
|
Deny from all
|
||||||
|
</IfModule>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The goal of this file is to allow developers a location
|
||||||
|
* where they can overwrite core procedural functions and
|
||||||
|
* replace them with their own. This file is loaded during
|
||||||
|
* the bootstrap process and is called during the framework's
|
||||||
|
* execution.
|
||||||
|
*
|
||||||
|
* This can be looked at as a `master helper` file that is
|
||||||
|
* loaded early on, and may also contain additional functions
|
||||||
|
* that you'd like to use throughout your entire application
|
||||||
|
*
|
||||||
|
* @see: https://codeigniter.com/user_guide/extending/common.html
|
||||||
|
*/
|
|
@ -0,0 +1,202 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class App extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Base Site URL
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* URL to your CodeIgniter root. Typically, this will be your base URL,
|
||||||
|
* WITH a trailing slash:
|
||||||
|
*
|
||||||
|
* E.g., http://example.com/
|
||||||
|
*/
|
||||||
|
public string $baseURL = 'http://localhost:8080/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
|
||||||
|
* If you want to accept multiple Hostnames, set this.
|
||||||
|
*
|
||||||
|
* E.g.,
|
||||||
|
* When your site URL ($baseURL) is 'http://example.com/', and your site
|
||||||
|
* also accepts 'http://media.example.com/' and 'http://accounts.example.com/':
|
||||||
|
* ['media.example.com', 'accounts.example.com']
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public array $allowedHostnames = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Index File
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Typically, this will be your `index.php` file, unless you've renamed it to
|
||||||
|
* something else. If you have configured your web server to remove this file
|
||||||
|
* from your site URIs, set this variable to an empty string.
|
||||||
|
*/
|
||||||
|
public string $indexPage = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* URI PROTOCOL
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This item determines which server global should be used to retrieve the
|
||||||
|
* URI string. The default setting of 'REQUEST_URI' works for most servers.
|
||||||
|
* If your links do not seem to work, try one of the other delicious flavors:
|
||||||
|
*
|
||||||
|
* 'REQUEST_URI': Uses $_SERVER['REQUEST_URI']
|
||||||
|
* 'QUERY_STRING': Uses $_SERVER['QUERY_STRING']
|
||||||
|
* 'PATH_INFO': Uses $_SERVER['PATH_INFO']
|
||||||
|
*
|
||||||
|
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
|
||||||
|
*/
|
||||||
|
public string $uriProtocol = 'REQUEST_URI';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Allowed URL Characters
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This lets you specify which characters are permitted within your URLs.
|
||||||
|
| When someone tries to submit a URL with disallowed characters they will
|
||||||
|
| get a warning message.
|
||||||
|
|
|
||||||
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
|
||||||
|
| as few characters as possible.
|
||||||
|
|
|
||||||
|
| By default, only these are allowed: `a-z 0-9~%.:_-`
|
||||||
|
|
|
||||||
|
| Set an empty string to allow all characters -- but only if you are insane.
|
||||||
|
|
|
||||||
|
| The configured value is actually a regular expression character group
|
||||||
|
| and it will be used as: '/\A[<permittedURIChars>]+\z/iu'
|
||||||
|
|
|
||||||
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
public string $permittedURIChars = 'a-z 0-9~%.:_\-';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Default Locale
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The Locale roughly represents the language and location that your visitor
|
||||||
|
* is viewing the site from. It affects the language strings and other
|
||||||
|
* strings (like currency markers, numbers, etc), that your program
|
||||||
|
* should run under for this request.
|
||||||
|
*/
|
||||||
|
public string $defaultLocale = 'en';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Negotiate Locale
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If true, the current Request object will automatically determine the
|
||||||
|
* language to use based on the value of the Accept-Language header.
|
||||||
|
*
|
||||||
|
* If false, no automatic detection will be performed.
|
||||||
|
*/
|
||||||
|
public bool $negotiateLocale = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Supported Locales
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If $negotiateLocale is true, this array lists the locales supported
|
||||||
|
* by the application in descending order of priority. If no match is
|
||||||
|
* found, the first locale will be used.
|
||||||
|
*
|
||||||
|
* IncomingRequest::setLocale() also uses this list.
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public array $supportedLocales = ['en'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Application Timezone
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The default timezone that will be used in your application to display
|
||||||
|
* dates with the date helper, and can be retrieved through app_timezone()
|
||||||
|
*
|
||||||
|
* @see https://www.php.net/manual/en/timezones.php for list of timezones
|
||||||
|
* supported by PHP.
|
||||||
|
*/
|
||||||
|
public string $appTimezone = 'Asia/Jakarta';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Default Character Set
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This determines which character set is used by default in various methods
|
||||||
|
* that require a character set to be provided.
|
||||||
|
*
|
||||||
|
* @see http://php.net/htmlspecialchars for a list of supported charsets.
|
||||||
|
*/
|
||||||
|
public string $charset = 'UTF-8';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Force Global Secure Requests
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If true, this will force every request made to this application to be
|
||||||
|
* made via a secure connection (HTTPS). If the incoming request is not
|
||||||
|
* secure, the user will be redirected to a secure version of the page
|
||||||
|
* and the HTTP Strict Transport Security (HSTS) header will be set.
|
||||||
|
*/
|
||||||
|
public bool $forceGlobalSecureRequests = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Reverse Proxy IPs
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If your server is behind a reverse proxy, you must whitelist the proxy
|
||||||
|
* IP addresses from which CodeIgniter should trust headers such as
|
||||||
|
* X-Forwarded-For or Client-IP in order to properly identify
|
||||||
|
* the visitor's IP address.
|
||||||
|
*
|
||||||
|
* You need to set a proxy IP address or IP address with subnets and
|
||||||
|
* the HTTP header for the client IP address.
|
||||||
|
*
|
||||||
|
* Here are some examples:
|
||||||
|
* [
|
||||||
|
* '10.0.1.200' => 'X-Forwarded-For',
|
||||||
|
* '192.168.5.0/24' => 'X-Real-IP',
|
||||||
|
* ]
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $proxyIPs = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Content Security Policy
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Enables the Response's Content Secure Policy to restrict the sources that
|
||||||
|
* can be used for images, scripts, CSS files, audio, video, etc. If enabled,
|
||||||
|
* the Response object will populate default values for the policy from the
|
||||||
|
* `ContentSecurityPolicy.php` file. Controllers can always add to those
|
||||||
|
* restrictions at run time.
|
||||||
|
*
|
||||||
|
* For a better understanding of CSP, see these documents:
|
||||||
|
*
|
||||||
|
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
|
||||||
|
* @see http://www.w3.org/TR/CSP/
|
||||||
|
*/
|
||||||
|
public bool $CSPEnabled = false;
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\AutoloadConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* AUTOLOADER CONFIGURATION
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This file defines the namespaces and class maps so the Autoloader
|
||||||
|
* can find the files as needed.
|
||||||
|
*
|
||||||
|
* NOTE: If you use an identical key in $psr4 or $classmap, then
|
||||||
|
* the values in this file will overwrite the framework's values.
|
||||||
|
*
|
||||||
|
* NOTE: This class is required prior to Autoloader instantiation,
|
||||||
|
* and does not extend BaseConfig.
|
||||||
|
*
|
||||||
|
* @immutable
|
||||||
|
*/
|
||||||
|
class Autoload extends AutoloadConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* Namespaces
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* This maps the locations of any namespaces in your application to
|
||||||
|
* their location on the file system. These are used by the autoloader
|
||||||
|
* to locate files the first time they have been instantiated.
|
||||||
|
*
|
||||||
|
* The 'Config' (APPPATH . 'Config') and 'CodeIgniter' (SYSTEMPATH) are
|
||||||
|
* already mapped for you.
|
||||||
|
*
|
||||||
|
* You may change the name of the 'App' namespace if you wish,
|
||||||
|
* but this should be done prior to creating any namespaced classes,
|
||||||
|
* else you will need to modify all of those classes for this to work.
|
||||||
|
*
|
||||||
|
* @var array<string, list<string>|string>
|
||||||
|
*/
|
||||||
|
public $psr4 = [
|
||||||
|
APP_NAMESPACE => APPPATH,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* Class Map
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* The class map provides a map of class names and their exact
|
||||||
|
* location on the drive. Classes loaded in this manner will have
|
||||||
|
* slightly faster performance because they will not have to be
|
||||||
|
* searched for within one or more directories as they would if they
|
||||||
|
* were being autoloaded through a namespace.
|
||||||
|
*
|
||||||
|
* Prototype:
|
||||||
|
* $classmap = [
|
||||||
|
* 'MyClass' => '/path/to/class/file.php'
|
||||||
|
* ];
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public $classmap = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* Files
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* The files array provides a list of paths to __non-class__ files
|
||||||
|
* that will be autoloaded. This can be useful for bootstrap operations
|
||||||
|
* or for loading functions.
|
||||||
|
*
|
||||||
|
* Prototype:
|
||||||
|
* $files = [
|
||||||
|
* '/path/to/my/file.php',
|
||||||
|
* ];
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public $files = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* Helpers
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* Prototype:
|
||||||
|
* $helpers = [
|
||||||
|
* 'form',
|
||||||
|
* ];
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public $helpers = [];
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ERROR DISPLAY
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| In development, we want to show as many errors as possible to help
|
||||||
|
| make sure they don't make it to production. And save us hours of
|
||||||
|
| painful debugging.
|
||||||
|
|
|
||||||
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
|
||||||
|
*/
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG BACKTRACES
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| If true, this constant will tell the error screens to display debug
|
||||||
|
| backtraces along with the other error information. If you would
|
||||||
|
| prefer to not see this, set this value to false.
|
||||||
|
*/
|
||||||
|
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG MODE
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Debug mode is an experimental flag that can allow changes throughout
|
||||||
|
| the system. This will control whether Kint is loaded, and a few other
|
||||||
|
| items. It can always be used within your own application too.
|
||||||
|
*/
|
||||||
|
defined('CI_DEBUG') || define('CI_DEBUG', true);
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ERROR DISPLAY
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Don't show ANY in production environments. Instead, let the system catch
|
||||||
|
| it and display a generic error message.
|
||||||
|
|
|
||||||
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
|
||||||
|
*/
|
||||||
|
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||||
|
// If you want to suppress more types of errors.
|
||||||
|
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG MODE
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Debug mode is an experimental flag that can allow changes throughout
|
||||||
|
| the system. It's not widely used currently, and may not survive
|
||||||
|
| release of the framework.
|
||||||
|
*/
|
||||||
|
defined('CI_DEBUG') || define('CI_DEBUG', false);
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The environment testing is reserved for PHPUnit testing. It has special
|
||||||
|
* conditions built into the framework at various places to assist with that.
|
||||||
|
* You can’t use it for your development.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ERROR DISPLAY
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| In development, we want to show as many errors as possible to help
|
||||||
|
| make sure they don't make it to production. And save us hours of
|
||||||
|
| painful debugging.
|
||||||
|
*/
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG BACKTRACES
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| If true, this constant will tell the error screens to display debug
|
||||||
|
| backtraces along with the other error information. If you would
|
||||||
|
| prefer to not see this, set this value to false.
|
||||||
|
*/
|
||||||
|
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG MODE
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Debug mode is an experimental flag that can allow changes throughout
|
||||||
|
| the system. It's not widely used currently, and may not survive
|
||||||
|
| release of the framework.
|
||||||
|
*/
|
||||||
|
defined('CI_DEBUG') || define('CI_DEBUG', true);
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class CURLRequest extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CURLRequest Share Options
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Whether share options between requests or not.
|
||||||
|
*
|
||||||
|
* If true, all the options won't be reset between requests.
|
||||||
|
* It may cause an error request with unnecessary headers.
|
||||||
|
*/
|
||||||
|
public bool $shareOptions = false;
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Cache\CacheInterface;
|
||||||
|
use CodeIgniter\Cache\Handlers\DummyHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\FileHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\MemcachedHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\PredisHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\RedisHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\WincacheHandler;
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Cache extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Primary Handler
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The name of the preferred handler that should be used. If for some reason
|
||||||
|
* it is not available, the $backupHandler will be used in its place.
|
||||||
|
*/
|
||||||
|
public string $handler = 'file';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Backup Handler
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The name of the handler that will be used in case the first one is
|
||||||
|
* unreachable. Often, 'file' is used here since the filesystem is
|
||||||
|
* always available, though that's not always practical for the app.
|
||||||
|
*/
|
||||||
|
public string $backupHandler = 'dummy';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cache Directory Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The path to where cache files should be stored, if using a file-based
|
||||||
|
* system.
|
||||||
|
*
|
||||||
|
* @deprecated Use the driver-specific variant under $file
|
||||||
|
*/
|
||||||
|
public string $storePath = WRITEPATH . 'cache/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Key Prefix
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This string is added to all cache item names to help avoid collisions
|
||||||
|
* if you run multiple applications with the same cache engine.
|
||||||
|
*/
|
||||||
|
public string $prefix = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Default TTL
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The default number of seconds to save items when none is specified.
|
||||||
|
*
|
||||||
|
* WARNING: This is not used by framework handlers where 60 seconds is
|
||||||
|
* hard-coded, but may be useful to projects and modules. This will replace
|
||||||
|
* the hard-coded value in a future release.
|
||||||
|
*/
|
||||||
|
public int $ttl = 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Reserved Characters
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* A string of reserved characters that will not be allowed in keys or tags.
|
||||||
|
* Strings that violate this restriction will cause handlers to throw.
|
||||||
|
* Default: {}()/\@:
|
||||||
|
*
|
||||||
|
* NOTE: The default set is required for PSR-6 compliance.
|
||||||
|
*/
|
||||||
|
public string $reservedCharacters = '{}()/\@:';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* File settings
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Your file storage preferences can be specified below, if you are using
|
||||||
|
* the File driver.
|
||||||
|
*
|
||||||
|
* @var array<string, int|string|null>
|
||||||
|
*/
|
||||||
|
public array $file = [
|
||||||
|
'storePath' => WRITEPATH . 'cache/',
|
||||||
|
'mode' => 0640,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* Memcached settings
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* Your Memcached servers can be specified below, if you are using
|
||||||
|
* the Memcached drivers.
|
||||||
|
*
|
||||||
|
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
||||||
|
*
|
||||||
|
* @var array<string, bool|int|string>
|
||||||
|
*/
|
||||||
|
public array $memcached = [
|
||||||
|
'host' => '127.0.0.1',
|
||||||
|
'port' => 11211,
|
||||||
|
'weight' => 1,
|
||||||
|
'raw' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* Redis settings
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* Your Redis server can be specified below, if you are using
|
||||||
|
* the Redis or Predis drivers.
|
||||||
|
*
|
||||||
|
* @var array<string, int|string|null>
|
||||||
|
*/
|
||||||
|
public array $redis = [
|
||||||
|
'host' => '127.0.0.1',
|
||||||
|
'password' => null,
|
||||||
|
'port' => 6379,
|
||||||
|
'timeout' => 0,
|
||||||
|
'database' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Available Cache Handlers
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This is an array of cache engine alias' and class names. Only engines
|
||||||
|
* that are listed here are allowed to be used.
|
||||||
|
*
|
||||||
|
* @var array<string, class-string<CacheInterface>>
|
||||||
|
*/
|
||||||
|
public array $validHandlers = [
|
||||||
|
'dummy' => DummyHandler::class,
|
||||||
|
'file' => FileHandler::class,
|
||||||
|
'memcached' => MemcachedHandler::class,
|
||||||
|
'predis' => PredisHandler::class,
|
||||||
|
'redis' => RedisHandler::class,
|
||||||
|
'wincache' => WincacheHandler::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Web Page Caching: Cache Include Query String
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Whether to take the URL query string into consideration when generating
|
||||||
|
* output cache files. Valid options are:
|
||||||
|
*
|
||||||
|
* false = Disabled
|
||||||
|
* true = Enabled, take all query parameters into account.
|
||||||
|
* Please be aware that this may result in numerous cache
|
||||||
|
* files generated for the same page over and over again.
|
||||||
|
* ['q'] = Enabled, but only take into account the specified list
|
||||||
|
* of query parameters.
|
||||||
|
*
|
||||||
|
* @var bool|list<string>
|
||||||
|
*/
|
||||||
|
public $cacheQueryString = false;
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
| --------------------------------------------------------------------
|
||||||
|
| App Namespace
|
||||||
|
| --------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This defines the default Namespace that is used throughout
|
||||||
|
| CodeIgniter to refer to the Application directory. Change
|
||||||
|
| this constant to change the namespace that all application
|
||||||
|
| classes should use.
|
||||||
|
|
|
||||||
|
| NOTE: changing this will require manually modifying the
|
||||||
|
| existing namespaces of App\* namespaced-classes.
|
||||||
|
*/
|
||||||
|
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
|
||||||
|
|
||||||
|
/*
|
||||||
|
| --------------------------------------------------------------------------
|
||||||
|
| Composer Path
|
||||||
|
| --------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The path that Composer's autoload file is expected to live. By default,
|
||||||
|
| the vendor folder is in the Root directory, but you can customize that here.
|
||||||
|
*/
|
||||||
|
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Timing Constants
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Provide simple ways to work with the myriad of PHP functions that
|
||||||
|
| require information to be in seconds.
|
||||||
|
*/
|
||||||
|
defined('SECOND') || define('SECOND', 1);
|
||||||
|
defined('MINUTE') || define('MINUTE', 60);
|
||||||
|
defined('HOUR') || define('HOUR', 3600);
|
||||||
|
defined('DAY') || define('DAY', 86400);
|
||||||
|
defined('WEEK') || define('WEEK', 604800);
|
||||||
|
defined('MONTH') || define('MONTH', 2_592_000);
|
||||||
|
defined('YEAR') || define('YEAR', 31_536_000);
|
||||||
|
defined('DECADE') || define('DECADE', 315_360_000);
|
||||||
|
|
||||||
|
/*
|
||||||
|
| --------------------------------------------------------------------------
|
||||||
|
| Exit Status Codes
|
||||||
|
| --------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Used to indicate the conditions under which the script is exit()ing.
|
||||||
|
| While there is no universal standard for error codes, there are some
|
||||||
|
| broad conventions. Three such conventions are mentioned below, for
|
||||||
|
| those who wish to make use of them. The CodeIgniter defaults were
|
||||||
|
| chosen for the least overlap with these conventions, while still
|
||||||
|
| leaving room for others to be defined in future versions and user
|
||||||
|
| applications.
|
||||||
|
|
|
||||||
|
| The three main conventions used for determining exit status codes
|
||||||
|
| are as follows:
|
||||||
|
|
|
||||||
|
| Standard C/C++ Library (stdlibc):
|
||||||
|
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
|
||||||
|
| (This link also contains other GNU-specific conventions)
|
||||||
|
| BSD sysexits.h:
|
||||||
|
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
|
||||||
|
| Bash scripting:
|
||||||
|
| http://tldp.org/LDP/abs/html/exitcodes.html
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
|
||||||
|
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
|
||||||
|
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
|
||||||
|
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
|
||||||
|
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
||||||
|
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
|
||||||
|
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
|
||||||
|
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
|
||||||
|
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
||||||
|
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
|
||||||
|
*/
|
||||||
|
define('EVENT_PRIORITY_LOW', 200);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
|
||||||
|
*/
|
||||||
|
define('EVENT_PRIORITY_NORMAL', 100);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
|
||||||
|
*/
|
||||||
|
define('EVENT_PRIORITY_HIGH', 10);
|
|
@ -0,0 +1,176 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the default settings for the ContentSecurityPolicy, if you
|
||||||
|
* choose to use it. The values here will be read in and set as defaults
|
||||||
|
* for the site. If needed, they can be overridden on a page-by-page basis.
|
||||||
|
*
|
||||||
|
* Suggested reference for explanations:
|
||||||
|
*
|
||||||
|
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
|
||||||
|
*/
|
||||||
|
class ContentSecurityPolicy extends BaseConfig
|
||||||
|
{
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Broadbrush CSP management
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default CSP report context
|
||||||
|
*/
|
||||||
|
public bool $reportOnly = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies a URL where a browser will send reports
|
||||||
|
* when a content security policy is violated.
|
||||||
|
*/
|
||||||
|
public ?string $reportURI = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instructs user agents to rewrite URL schemes, changing
|
||||||
|
* HTTP to HTTPS. This directive is for websites with
|
||||||
|
* large numbers of old URLs that need to be rewritten.
|
||||||
|
*/
|
||||||
|
public bool $upgradeInsecureRequests = false;
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Sources allowed
|
||||||
|
// NOTE: once you set a policy to 'none', it cannot be further restricted
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will default to self if not overridden
|
||||||
|
*
|
||||||
|
* @var list<string>|string|null
|
||||||
|
*/
|
||||||
|
public $defaultSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists allowed scripts' URLs.
|
||||||
|
*
|
||||||
|
* @var list<string>|string
|
||||||
|
*/
|
||||||
|
public $scriptSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists allowed stylesheets' URLs.
|
||||||
|
*
|
||||||
|
* @var list<string>|string
|
||||||
|
*/
|
||||||
|
public $styleSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the origins from which images can be loaded.
|
||||||
|
*
|
||||||
|
* @var list<string>|string
|
||||||
|
*/
|
||||||
|
public $imageSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restricts the URLs that can appear in a page's `<base>` element.
|
||||||
|
*
|
||||||
|
* Will default to self if not overridden
|
||||||
|
*
|
||||||
|
* @var list<string>|string|null
|
||||||
|
*/
|
||||||
|
public $baseURI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists the URLs for workers and embedded frame contents
|
||||||
|
*
|
||||||
|
* @var list<string>|string
|
||||||
|
*/
|
||||||
|
public $childSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limits the origins that you can connect to (via XHR,
|
||||||
|
* WebSockets, and EventSource).
|
||||||
|
*
|
||||||
|
* @var list<string>|string
|
||||||
|
*/
|
||||||
|
public $connectSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the origins that can serve web fonts.
|
||||||
|
*
|
||||||
|
* @var list<string>|string
|
||||||
|
*/
|
||||||
|
public $fontSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists valid endpoints for submission from `<form>` tags.
|
||||||
|
*
|
||||||
|
* @var list<string>|string
|
||||||
|
*/
|
||||||
|
public $formAction = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the sources that can embed the current page.
|
||||||
|
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
|
||||||
|
* and `<applet>` tags. This directive can't be used in
|
||||||
|
* `<meta>` tags and applies only to non-HTML resources.
|
||||||
|
*
|
||||||
|
* @var list<string>|string|null
|
||||||
|
*/
|
||||||
|
public $frameAncestors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The frame-src directive restricts the URLs which may
|
||||||
|
* be loaded into nested browsing contexts.
|
||||||
|
*
|
||||||
|
* @var list<string>|string|null
|
||||||
|
*/
|
||||||
|
public $frameSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restricts the origins allowed to deliver video and audio.
|
||||||
|
*
|
||||||
|
* @var list<string>|string|null
|
||||||
|
*/
|
||||||
|
public $mediaSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows control over Flash and other plugins.
|
||||||
|
*
|
||||||
|
* @var list<string>|string
|
||||||
|
*/
|
||||||
|
public $objectSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var list<string>|string|null
|
||||||
|
*/
|
||||||
|
public $manifestSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limits the kinds of plugins a page may invoke.
|
||||||
|
*
|
||||||
|
* @var list<string>|string|null
|
||||||
|
*/
|
||||||
|
public $pluginTypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of actions allowed.
|
||||||
|
*
|
||||||
|
* @var list<string>|string|null
|
||||||
|
*/
|
||||||
|
public $sandbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nonce tag for style
|
||||||
|
*/
|
||||||
|
public string $styleNonceTag = '{csp-style-nonce}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nonce tag for script
|
||||||
|
*/
|
||||||
|
public string $scriptNonceTag = '{csp-script-nonce}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace nonce tag automatically
|
||||||
|
*/
|
||||||
|
public bool $autoNonce = true;
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use DateTimeInterface;
|
||||||
|
|
||||||
|
class Cookie extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Prefix
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Set a cookie name prefix if you need to avoid collisions.
|
||||||
|
*/
|
||||||
|
public string $prefix = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Expires Timestamp
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Default expires timestamp for cookies. Setting this to `0` will mean the
|
||||||
|
* cookie will not have the `Expires` attribute and will behave as a session
|
||||||
|
* cookie.
|
||||||
|
*
|
||||||
|
* @var DateTimeInterface|int|string
|
||||||
|
*/
|
||||||
|
public $expires = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Typically will be a forward slash.
|
||||||
|
*/
|
||||||
|
public string $path = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Domain
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Set to `.your-domain.com` for site-wide cookies.
|
||||||
|
*/
|
||||||
|
public string $domain = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Secure
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be set if a secure HTTPS connection exists.
|
||||||
|
*/
|
||||||
|
public bool $secure = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie HTTPOnly
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be accessible via HTTP(S) (no JavaScript).
|
||||||
|
*/
|
||||||
|
public bool $httponly = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie SameSite
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Configure cookie SameSite setting. Allowed values are:
|
||||||
|
* - None
|
||||||
|
* - Lax
|
||||||
|
* - Strict
|
||||||
|
* - ''
|
||||||
|
*
|
||||||
|
* Alternatively, you can use the constant names:
|
||||||
|
* - `Cookie::SAMESITE_NONE`
|
||||||
|
* - `Cookie::SAMESITE_LAX`
|
||||||
|
* - `Cookie::SAMESITE_STRICT`
|
||||||
|
*
|
||||||
|
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
|
||||||
|
* (empty string) means default SameSite attribute set by browsers (`Lax`)
|
||||||
|
* will be set on cookies. If set to `None`, `$secure` must also be set.
|
||||||
|
*
|
||||||
|
* @phpstan-var 'None'|'Lax'|'Strict'|''
|
||||||
|
*/
|
||||||
|
public string $samesite = 'Lax';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Raw
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This flag allows setting a "raw" cookie, i.e., its name and value are
|
||||||
|
* not URL encoded using `rawurlencode()`.
|
||||||
|
*
|
||||||
|
* If this is set to `true`, cookie names should be compliant of RFC 2616's
|
||||||
|
* list of allowed characters.
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
|
||||||
|
* @see https://tools.ietf.org/html/rfc2616#section-2.2
|
||||||
|
*/
|
||||||
|
public bool $raw = false;
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cross-Origin Resource Sharing (CORS) Configuration
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||||
|
*/
|
||||||
|
class Cors extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The default CORS configuration.
|
||||||
|
*
|
||||||
|
* @var array{
|
||||||
|
* allowedOrigins: list<string>,
|
||||||
|
* allowedOriginsPatterns: list<string>,
|
||||||
|
* supportsCredentials: bool,
|
||||||
|
* allowedHeaders: list<string>,
|
||||||
|
* exposedHeaders: list<string>,
|
||||||
|
* allowedMethods: list<string>,
|
||||||
|
* maxAge: int,
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
public array $default = [
|
||||||
|
/**
|
||||||
|
* Origins for the `Access-Control-Allow-Origin` header.
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
|
||||||
|
*
|
||||||
|
* E.g.:
|
||||||
|
* - ['http://localhost:8080']
|
||||||
|
* - ['https://www.example.com']
|
||||||
|
*/
|
||||||
|
'allowedOrigins' => [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Origin regex patterns for the `Access-Control-Allow-Origin` header.
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
|
||||||
|
*
|
||||||
|
* NOTE: A pattern specified here is part of a regular expression. It will
|
||||||
|
* be actually `#\A<pattern>\z#`.
|
||||||
|
*
|
||||||
|
* E.g.:
|
||||||
|
* - ['https://\w+\.example\.com']
|
||||||
|
*/
|
||||||
|
'allowedOriginsPatterns' => [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weather to send the `Access-Control-Allow-Credentials` header.
|
||||||
|
*
|
||||||
|
* The Access-Control-Allow-Credentials response header tells browsers whether
|
||||||
|
* the server allows cross-origin HTTP requests to include credentials.
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
|
||||||
|
*/
|
||||||
|
'supportsCredentials' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set headers to allow.
|
||||||
|
*
|
||||||
|
* The Access-Control-Allow-Headers response header is used in response to
|
||||||
|
* a preflight request which includes the Access-Control-Request-Headers to
|
||||||
|
* indicate which HTTP headers can be used during the actual request.
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
|
||||||
|
*/
|
||||||
|
'allowedHeaders' => [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set headers to expose.
|
||||||
|
*
|
||||||
|
* The Access-Control-Expose-Headers response header allows a server to
|
||||||
|
* indicate which response headers should be made available to scripts running
|
||||||
|
* in the browser, in response to a cross-origin request.
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
|
||||||
|
*/
|
||||||
|
'exposedHeaders' => [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set methods to allow.
|
||||||
|
*
|
||||||
|
* The Access-Control-Allow-Methods response header specifies one or more
|
||||||
|
* methods allowed when accessing a resource in response to a preflight
|
||||||
|
* request.
|
||||||
|
*
|
||||||
|
* E.g.:
|
||||||
|
* - ['GET', 'POST', 'PUT', 'DELETE']
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
|
||||||
|
*/
|
||||||
|
'allowedMethods' => [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set how many seconds the results of a preflight request can be cached.
|
||||||
|
*
|
||||||
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
|
||||||
|
*/
|
||||||
|
'maxAge' => 7200,
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,201 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database Configuration
|
||||||
|
*/
|
||||||
|
class Database extends Config
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The directory that holds the Migrations and Seeds directories.
|
||||||
|
*/
|
||||||
|
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets you choose which connection group to use if no other is specified.
|
||||||
|
*/
|
||||||
|
public string $defaultGroup = 'default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database connection.
|
||||||
|
*
|
||||||
|
* @var array<string, mixed>
|
||||||
|
*/
|
||||||
|
public array $default = [
|
||||||
|
'DSN' => '',
|
||||||
|
'hostname' => 'localhost',
|
||||||
|
'username' => '',
|
||||||
|
'password' => '',
|
||||||
|
'database' => '',
|
||||||
|
'DBDriver' => 'MySQLi',
|
||||||
|
'DBPrefix' => '',
|
||||||
|
'pConnect' => false,
|
||||||
|
'DBDebug' => true,
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'DBCollat' => 'utf8mb4_general_ci',
|
||||||
|
'swapPre' => '',
|
||||||
|
'encrypt' => false,
|
||||||
|
'compress' => false,
|
||||||
|
'strictOn' => false,
|
||||||
|
'failover' => [],
|
||||||
|
'port' => 3306,
|
||||||
|
'numberNative' => false,
|
||||||
|
'dateFormat' => [
|
||||||
|
'date' => 'Y-m-d',
|
||||||
|
'datetime' => 'Y-m-d H:i:s',
|
||||||
|
'time' => 'H:i:s',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Sample database connection for SQLite3.
|
||||||
|
// *
|
||||||
|
// * @var array<string, mixed>
|
||||||
|
// */
|
||||||
|
// public array $default = [
|
||||||
|
// 'database' => 'database.db',
|
||||||
|
// 'DBDriver' => 'SQLite3',
|
||||||
|
// 'DBPrefix' => '',
|
||||||
|
// 'DBDebug' => true,
|
||||||
|
// 'swapPre' => '',
|
||||||
|
// 'failover' => [],
|
||||||
|
// 'foreignKeys' => true,
|
||||||
|
// 'busyTimeout' => 1000,
|
||||||
|
// 'dateFormat' => [
|
||||||
|
// 'date' => 'Y-m-d',
|
||||||
|
// 'datetime' => 'Y-m-d H:i:s',
|
||||||
|
// 'time' => 'H:i:s',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Sample database connection for Postgre.
|
||||||
|
// *
|
||||||
|
// * @var array<string, mixed>
|
||||||
|
// */
|
||||||
|
// public array $default = [
|
||||||
|
// 'DSN' => '',
|
||||||
|
// 'hostname' => 'localhost',
|
||||||
|
// 'username' => 'root',
|
||||||
|
// 'password' => 'root',
|
||||||
|
// 'database' => 'ci4',
|
||||||
|
// 'schema' => 'public',
|
||||||
|
// 'DBDriver' => 'Postgre',
|
||||||
|
// 'DBPrefix' => '',
|
||||||
|
// 'pConnect' => false,
|
||||||
|
// 'DBDebug' => true,
|
||||||
|
// 'charset' => 'utf8',
|
||||||
|
// 'swapPre' => '',
|
||||||
|
// 'failover' => [],
|
||||||
|
// 'port' => 5432,
|
||||||
|
// 'dateFormat' => [
|
||||||
|
// 'date' => 'Y-m-d',
|
||||||
|
// 'datetime' => 'Y-m-d H:i:s',
|
||||||
|
// 'time' => 'H:i:s',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Sample database connection for SQLSRV.
|
||||||
|
// *
|
||||||
|
// * @var array<string, mixed>
|
||||||
|
// */
|
||||||
|
// public array $default = [
|
||||||
|
// 'DSN' => '',
|
||||||
|
// 'hostname' => 'localhost',
|
||||||
|
// 'username' => 'root',
|
||||||
|
// 'password' => 'root',
|
||||||
|
// 'database' => 'ci4',
|
||||||
|
// 'schema' => 'dbo',
|
||||||
|
// 'DBDriver' => 'SQLSRV',
|
||||||
|
// 'DBPrefix' => '',
|
||||||
|
// 'pConnect' => false,
|
||||||
|
// 'DBDebug' => true,
|
||||||
|
// 'charset' => 'utf8',
|
||||||
|
// 'swapPre' => '',
|
||||||
|
// 'encrypt' => false,
|
||||||
|
// 'failover' => [],
|
||||||
|
// 'port' => 1433,
|
||||||
|
// 'dateFormat' => [
|
||||||
|
// 'date' => 'Y-m-d',
|
||||||
|
// 'datetime' => 'Y-m-d H:i:s',
|
||||||
|
// 'time' => 'H:i:s',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Sample database connection for OCI8.
|
||||||
|
// *
|
||||||
|
// * You may need the following environment variables:
|
||||||
|
// * NLS_LANG = 'AMERICAN_AMERICA.UTF8'
|
||||||
|
// * NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
|
||||||
|
// * NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
|
||||||
|
// * NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
|
||||||
|
// *
|
||||||
|
// * @var array<string, mixed>
|
||||||
|
// */
|
||||||
|
// public array $default = [
|
||||||
|
// 'DSN' => 'localhost:1521/XEPDB1',
|
||||||
|
// 'username' => 'root',
|
||||||
|
// 'password' => 'root',
|
||||||
|
// 'DBDriver' => 'OCI8',
|
||||||
|
// 'DBPrefix' => '',
|
||||||
|
// 'pConnect' => false,
|
||||||
|
// 'DBDebug' => true,
|
||||||
|
// 'charset' => 'AL32UTF8',
|
||||||
|
// 'swapPre' => '',
|
||||||
|
// 'failover' => [],
|
||||||
|
// 'dateFormat' => [
|
||||||
|
// 'date' => 'Y-m-d',
|
||||||
|
// 'datetime' => 'Y-m-d H:i:s',
|
||||||
|
// 'time' => 'H:i:s',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This database connection is used when running PHPUnit database tests.
|
||||||
|
*
|
||||||
|
* @var array<string, mixed>
|
||||||
|
*/
|
||||||
|
public array $tests = [
|
||||||
|
'DSN' => '',
|
||||||
|
'hostname' => '127.0.0.1',
|
||||||
|
'username' => '',
|
||||||
|
'password' => '',
|
||||||
|
'database' => ':memory:',
|
||||||
|
'DBDriver' => 'SQLite3',
|
||||||
|
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
|
||||||
|
'pConnect' => false,
|
||||||
|
'DBDebug' => true,
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'DBCollat' => '',
|
||||||
|
'swapPre' => '',
|
||||||
|
'encrypt' => false,
|
||||||
|
'compress' => false,
|
||||||
|
'strictOn' => false,
|
||||||
|
'failover' => [],
|
||||||
|
'port' => 3306,
|
||||||
|
'foreignKeys' => true,
|
||||||
|
'busyTimeout' => 1000,
|
||||||
|
'dateFormat' => [
|
||||||
|
'date' => 'Y-m-d',
|
||||||
|
'datetime' => 'Y-m-d H:i:s',
|
||||||
|
'time' => 'H:i:s',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// Ensure that we always set the database group to 'tests' if
|
||||||
|
// we are currently running an automated test suite, so that
|
||||||
|
// we don't overwrite live data on accident.
|
||||||
|
if (ENVIRONMENT === 'testing') {
|
||||||
|
$this->defaultGroup = 'tests';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @immutable
|
||||||
|
*/
|
||||||
|
class DocTypes
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* List of valid document types.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $list = [
|
||||||
|
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||||
|
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||||
|
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||||
|
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||||
|
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
|
||||||
|
'html5' => '<!DOCTYPE html>',
|
||||||
|
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||||
|
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
||||||
|
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
|
||||||
|
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
|
||||||
|
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
|
||||||
|
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
|
||||||
|
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
|
||||||
|
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
|
||||||
|
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
|
||||||
|
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||||
|
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||||
|
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
|
||||||
|
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
|
||||||
|
* for HTML5 compatibility.
|
||||||
|
*
|
||||||
|
* Set to:
|
||||||
|
* `true` - to be HTML5 compatible
|
||||||
|
* `false` - to be XHTML compatible
|
||||||
|
*/
|
||||||
|
public bool $html5 = true;
|
||||||
|
}
|
|
@ -0,0 +1,121 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Email extends BaseConfig
|
||||||
|
{
|
||||||
|
public string $fromEmail = '';
|
||||||
|
public string $fromName = '';
|
||||||
|
public string $recipients = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "user agent"
|
||||||
|
*/
|
||||||
|
public string $userAgent = 'CodeIgniter';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mail sending protocol: mail, sendmail, smtp
|
||||||
|
*/
|
||||||
|
public string $protocol = 'mail';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server path to Sendmail.
|
||||||
|
*/
|
||||||
|
public string $mailPath = '/usr/sbin/sendmail';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Server Hostname
|
||||||
|
*/
|
||||||
|
public string $SMTPHost = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Username
|
||||||
|
*/
|
||||||
|
public string $SMTPUser = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Password
|
||||||
|
*/
|
||||||
|
public string $SMTPPass = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Port
|
||||||
|
*/
|
||||||
|
public int $SMTPPort = 25;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Timeout (in seconds)
|
||||||
|
*/
|
||||||
|
public int $SMTPTimeout = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable persistent SMTP connections
|
||||||
|
*/
|
||||||
|
public bool $SMTPKeepAlive = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Encryption.
|
||||||
|
*
|
||||||
|
* @var string '', 'tls' or 'ssl'. 'tls' will issue a STARTTLS command
|
||||||
|
* to the server. 'ssl' means implicit SSL. Connection on port
|
||||||
|
* 465 should set this to ''.
|
||||||
|
*/
|
||||||
|
public string $SMTPCrypto = 'tls';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable word-wrap
|
||||||
|
*/
|
||||||
|
public bool $wordWrap = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Character count to wrap at
|
||||||
|
*/
|
||||||
|
public int $wrapChars = 76;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of mail, either 'text' or 'html'
|
||||||
|
*/
|
||||||
|
public string $mailType = 'text';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Character set (utf-8, iso-8859-1, etc.)
|
||||||
|
*/
|
||||||
|
public string $charset = 'UTF-8';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to validate the email address
|
||||||
|
*/
|
||||||
|
public bool $validate = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
|
||||||
|
*/
|
||||||
|
public int $priority = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||||
|
*/
|
||||||
|
public string $CRLF = "\r\n";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||||
|
*/
|
||||||
|
public string $newline = "\r\n";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable BCC Batch Mode.
|
||||||
|
*/
|
||||||
|
public bool $BCCBatchMode = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of emails in each BCC batch
|
||||||
|
*/
|
||||||
|
public int $BCCBatchSize = 200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable notify message from server
|
||||||
|
*/
|
||||||
|
public bool $DSN = false;
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encryption configuration.
|
||||||
|
*
|
||||||
|
* These are the settings used for encryption, if you don't pass a parameter
|
||||||
|
* array to the encrypter for creation/initialization.
|
||||||
|
*/
|
||||||
|
class Encryption extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Encryption Key Starter
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If you use the Encryption class you must set an encryption key (seed).
|
||||||
|
* You need to ensure it is long enough for the cipher and mode you plan to use.
|
||||||
|
* See the user guide for more info.
|
||||||
|
*/
|
||||||
|
public string $key = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Encryption Driver to Use
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* One of the supported encryption drivers.
|
||||||
|
*
|
||||||
|
* Available drivers:
|
||||||
|
* - OpenSSL
|
||||||
|
* - Sodium
|
||||||
|
*/
|
||||||
|
public string $driver = 'OpenSSL';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* SodiumHandler's Padding Length in Bytes
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This is the number of bytes that will be padded to the plaintext message
|
||||||
|
* before it is encrypted. This value should be greater than zero.
|
||||||
|
*
|
||||||
|
* See the user guide for more information on padding.
|
||||||
|
*/
|
||||||
|
public int $blockSize = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Encryption digest
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
|
||||||
|
*/
|
||||||
|
public string $digest = 'SHA512';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
|
||||||
|
* This setting is only used by OpenSSLHandler.
|
||||||
|
*
|
||||||
|
* Set to false for CI3 Encryption compatibility.
|
||||||
|
*/
|
||||||
|
public bool $rawData = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encryption key info.
|
||||||
|
* This setting is only used by OpenSSLHandler.
|
||||||
|
*
|
||||||
|
* Set to 'encryption' for CI3 Encryption compatibility.
|
||||||
|
*/
|
||||||
|
public string $encryptKeyInfo = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authentication key info.
|
||||||
|
* This setting is only used by OpenSSLHandler.
|
||||||
|
*
|
||||||
|
* Set to 'authentication' for CI3 Encryption compatibility.
|
||||||
|
*/
|
||||||
|
public string $authKeyInfo = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cipher to use.
|
||||||
|
* This setting is only used by OpenSSLHandler.
|
||||||
|
*
|
||||||
|
* Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
|
||||||
|
* by CI3 Encryption default configuration.
|
||||||
|
*/
|
||||||
|
public string $cipher = 'AES-256-CTR';
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Events\Events;
|
||||||
|
use CodeIgniter\Exceptions\FrameworkException;
|
||||||
|
use CodeIgniter\HotReloader\HotReloader;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Application Events
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Events allow you to tap into the execution of the program without
|
||||||
|
* modifying or extending core files. This file provides a central
|
||||||
|
* location to define your events, though they can always be added
|
||||||
|
* at run-time, also, if needed.
|
||||||
|
*
|
||||||
|
* You create code that can execute by subscribing to events with
|
||||||
|
* the 'on()' method. This accepts any form of callable, including
|
||||||
|
* Closures, that will be executed when the event is triggered.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* Events::on('create', [$myInstance, 'myMethod']);
|
||||||
|
*/
|
||||||
|
|
||||||
|
Events::on('pre_system', static function () {
|
||||||
|
if (ENVIRONMENT !== 'testing') {
|
||||||
|
if (ini_get('zlib.output_compression')) {
|
||||||
|
throw FrameworkException::forEnabledZlibOutputCompression();
|
||||||
|
}
|
||||||
|
|
||||||
|
while (ob_get_level() > 0) {
|
||||||
|
ob_end_flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start(static fn ($buffer) => $buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Debug Toolbar Listeners.
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* If you delete, they will no longer be collected.
|
||||||
|
*/
|
||||||
|
if (CI_DEBUG && ! is_cli()) {
|
||||||
|
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
|
||||||
|
Services::toolbar()->respond();
|
||||||
|
// Hot Reload route - for framework use on the hot reloader.
|
||||||
|
if (ENVIRONMENT === 'development') {
|
||||||
|
Services::routes()->get('__hot-reload', static function () {
|
||||||
|
(new HotReloader())->run();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,108 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Debug\ExceptionHandler;
|
||||||
|
use CodeIgniter\Debug\ExceptionHandlerInterface;
|
||||||
|
use Psr\Log\LogLevel;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup how the exception handler works.
|
||||||
|
*/
|
||||||
|
class Exceptions extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* LOG EXCEPTIONS?
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* If true, then exceptions will be logged
|
||||||
|
* through Services::Log.
|
||||||
|
*
|
||||||
|
* Default: true
|
||||||
|
*/
|
||||||
|
public bool $log = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* DO NOT LOG STATUS CODES
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Any status codes here will NOT be logged if logging is turned on.
|
||||||
|
* By default, only 404 (Page Not Found) exceptions are ignored.
|
||||||
|
*
|
||||||
|
* @var list<int>
|
||||||
|
*/
|
||||||
|
public array $ignoreCodes = [404];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Error Views Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* This is the path to the directory that contains the 'cli' and 'html'
|
||||||
|
* directories that hold the views used to generate errors.
|
||||||
|
*
|
||||||
|
* Default: APPPATH.'Views/errors'
|
||||||
|
*/
|
||||||
|
public string $errorViewPath = APPPATH . 'Views/errors';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* HIDE FROM DEBUG TRACE
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Any data that you would like to hide from the debug trace.
|
||||||
|
* In order to specify 2 levels, use "/" to separate.
|
||||||
|
* ex. ['server', 'setup/password', 'secret_token']
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public array $sensitiveDataInTrace = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* LOG DEPRECATIONS INSTEAD OF THROWING?
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* By default, CodeIgniter converts deprecations into exceptions. Also,
|
||||||
|
* starting in PHP 8.1 will cause a lot of deprecated usage warnings.
|
||||||
|
* Use this option to temporarily cease the warnings and instead log those.
|
||||||
|
* This option also works for user deprecations.
|
||||||
|
*/
|
||||||
|
public bool $logDeprecations = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* If `$logDeprecations` is set to `true`, this sets the log level
|
||||||
|
* to which the deprecation will be logged. This should be one of the log
|
||||||
|
* levels recognized by PSR-3.
|
||||||
|
*
|
||||||
|
* The related `Config\Logger::$threshold` should be adjusted, if needed,
|
||||||
|
* to capture logging the deprecations.
|
||||||
|
*/
|
||||||
|
public string $deprecationLogLevel = LogLevel::WARNING;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DEFINE THE HANDLERS USED
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Given the HTTP status code, returns exception handler that
|
||||||
|
* should be used to deal with this error. By default, it will run CodeIgniter's
|
||||||
|
* default handler and display the error information in the expected format
|
||||||
|
* for CLI, HTTP, or AJAX requests, as determined by is_cli() and the expected
|
||||||
|
* response format.
|
||||||
|
*
|
||||||
|
* Custom handlers can be returned if you want to handle one or more specific
|
||||||
|
* error codes yourself like:
|
||||||
|
*
|
||||||
|
* if (in_array($statusCode, [400, 404, 500])) {
|
||||||
|
* return new \App\Libraries\MyExceptionHandler();
|
||||||
|
* }
|
||||||
|
* if ($exception instanceOf PageNotFoundException) {
|
||||||
|
* return new \App\Libraries\MyExceptionHandler();
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
|
||||||
|
{
|
||||||
|
return new ExceptionHandler($this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable backward compatibility breaking features.
|
||||||
|
*/
|
||||||
|
class Feature extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Use improved new auto routing instead of the default legacy version.
|
||||||
|
*/
|
||||||
|
public bool $autoRoutesImproved = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use filter execution order in 4.4 or before.
|
||||||
|
*/
|
||||||
|
public bool $oldFilterOrder = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The behavior of `limit(0)` in Query Builder.
|
||||||
|
*
|
||||||
|
* If true, `limit(0)` returns all records. (the behavior of 4.4.x or before in version 4.x.)
|
||||||
|
* If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.)
|
||||||
|
*/
|
||||||
|
public bool $limitZeroAsAll = true;
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use App\Filters\IsAuthenticated;
|
||||||
|
use App\Filters\IsAuthenticatedAs;
|
||||||
|
use CodeIgniter\Config\Filters as BaseFilters;
|
||||||
|
use CodeIgniter\Filters\Cors;
|
||||||
|
use CodeIgniter\Filters\CSRF;
|
||||||
|
use CodeIgniter\Filters\DebugToolbar;
|
||||||
|
use CodeIgniter\Filters\ForceHTTPS;
|
||||||
|
use CodeIgniter\Filters\Honeypot;
|
||||||
|
use CodeIgniter\Filters\InvalidChars;
|
||||||
|
use CodeIgniter\Filters\PageCache;
|
||||||
|
use CodeIgniter\Filters\PerformanceMetrics;
|
||||||
|
use CodeIgniter\Filters\SecureHeaders;
|
||||||
|
|
||||||
|
class Filters extends BaseFilters
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Configures aliases for Filter classes to
|
||||||
|
* make reading things nicer and simpler.
|
||||||
|
*
|
||||||
|
* @var array<string, class-string|list<class-string>>
|
||||||
|
*
|
||||||
|
* [filter_name => classname]
|
||||||
|
* or [filter_name => [classname1, classname2, ...]]
|
||||||
|
*/
|
||||||
|
public array $aliases = [
|
||||||
|
'csrf' => CSRF::class,
|
||||||
|
'toolbar' => DebugToolbar::class,
|
||||||
|
'honeypot' => Honeypot::class,
|
||||||
|
'invalidchars' => InvalidChars::class,
|
||||||
|
'secureheaders' => SecureHeaders::class,
|
||||||
|
'cors' => Cors::class,
|
||||||
|
'forcehttps' => ForceHTTPS::class,
|
||||||
|
'pagecache' => PageCache::class,
|
||||||
|
'performance' => PerformanceMetrics::class,
|
||||||
|
'isAuthenticated' => IsAuthenticated::class,
|
||||||
|
'isAuthenticatedAs' => IsAuthenticatedAs::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of special required filters.
|
||||||
|
*
|
||||||
|
* The filters listed here are special. They are applied before and after
|
||||||
|
* other kinds of filters, and always applied even if a route does not exist.
|
||||||
|
*
|
||||||
|
* Filters set by default provide framework functionality. If removed,
|
||||||
|
* those functions will no longer work.
|
||||||
|
*
|
||||||
|
* @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
|
||||||
|
*
|
||||||
|
* @var array{before: list<string>, after: list<string>}
|
||||||
|
*/
|
||||||
|
public array $required = [
|
||||||
|
'before' => [
|
||||||
|
'forcehttps', // Force Global Secure Requests
|
||||||
|
'pagecache', // Web Page Caching
|
||||||
|
],
|
||||||
|
'after' => [
|
||||||
|
'pagecache', // Web Page Caching
|
||||||
|
'performance', // Performance Metrics
|
||||||
|
'toolbar', // Debug Toolbar
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of filter aliases that are always
|
||||||
|
* applied before and after every request.
|
||||||
|
*
|
||||||
|
* @var array<string, array<string, array<string, string>>>|array<string, list<string>>
|
||||||
|
*/
|
||||||
|
public array $globals = [
|
||||||
|
'before' => [
|
||||||
|
// 'honeypot',
|
||||||
|
// 'csrf',
|
||||||
|
// 'invalidchars',
|
||||||
|
],
|
||||||
|
'after' => [
|
||||||
|
// 'honeypot',
|
||||||
|
// 'secureheaders',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of filter aliases that works on a
|
||||||
|
* particular HTTP method (GET, POST, etc.).
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* 'POST' => ['foo', 'bar']
|
||||||
|
*
|
||||||
|
* If you use this, you should disable auto-routing because auto-routing
|
||||||
|
* permits any HTTP method to access a controller. Accessing the controller
|
||||||
|
* with a method you don't expect could bypass the filter.
|
||||||
|
*
|
||||||
|
* @var array<string, list<string>>
|
||||||
|
*/
|
||||||
|
public array $methods = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of filter aliases that should run on any
|
||||||
|
* before or after URI patterns.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
|
||||||
|
*
|
||||||
|
* @var array<string, array<string, list<string>>>
|
||||||
|
*/
|
||||||
|
public array $filters = [];
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @immutable
|
||||||
|
*/
|
||||||
|
class ForeignCharacters extends BaseForeignCharacters
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Format\FormatterInterface;
|
||||||
|
use CodeIgniter\Format\JSONFormatter;
|
||||||
|
use CodeIgniter\Format\XMLFormatter;
|
||||||
|
|
||||||
|
class Format extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Available Response Formats
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* When you perform content negotiation with the request, these are the
|
||||||
|
* available formats that your application supports. This is currently
|
||||||
|
* only used with the API\ResponseTrait. A valid Formatter must exist
|
||||||
|
* for the specified format.
|
||||||
|
*
|
||||||
|
* These formats are only checked when the data passed to the respond()
|
||||||
|
* method is an array.
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public array $supportedResponseFormats = [
|
||||||
|
'application/json',
|
||||||
|
'application/xml', // machine-readable XML
|
||||||
|
'text/xml', // human-readable XML
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Formatters
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Lists the class to use to format responses with of a particular type.
|
||||||
|
* For each mime type, list the class that should be used. Formatters
|
||||||
|
* can be retrieved through the getFormatter() method.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $formatters = [
|
||||||
|
'application/json' => JSONFormatter::class,
|
||||||
|
'application/xml' => XMLFormatter::class,
|
||||||
|
'text/xml' => XMLFormatter::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Formatters Options
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Additional Options to adjust default formatters behaviour.
|
||||||
|
* For each mime type, list the additional options that should be used.
|
||||||
|
*
|
||||||
|
* @var array<string, int>
|
||||||
|
*/
|
||||||
|
public array $formatterOptions = [
|
||||||
|
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
|
||||||
|
'application/xml' => 0,
|
||||||
|
'text/xml' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Factory method to return the appropriate formatter for the given mime type.
|
||||||
|
*
|
||||||
|
* @return FormatterInterface
|
||||||
|
*
|
||||||
|
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
|
||||||
|
*/
|
||||||
|
public function getFormatter(string $mime)
|
||||||
|
{
|
||||||
|
return Services::format()->getFormatter($mime);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Generators extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Generator Commands' Views
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This array defines the mapping of generator commands to the view files
|
||||||
|
* they are using. If you need to customize them for your own, copy these
|
||||||
|
* view files in your own folder and indicate the location here.
|
||||||
|
*
|
||||||
|
* You will notice that the views have special placeholders enclosed in
|
||||||
|
* curly braces `{...}`. These placeholders are used internally by the
|
||||||
|
* generator commands in processing replacements, thus you are warned
|
||||||
|
* not to delete them or modify the names. If you will do so, you may
|
||||||
|
* end up disrupting the scaffolding process and throw errors.
|
||||||
|
*
|
||||||
|
* YOU HAVE BEEN WARNED!
|
||||||
|
*
|
||||||
|
* @var array<string, array<string, string>|string>
|
||||||
|
*/
|
||||||
|
public array $views = [
|
||||||
|
'make:cell' => [
|
||||||
|
'class' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
|
||||||
|
'view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php',
|
||||||
|
],
|
||||||
|
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
|
||||||
|
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
|
||||||
|
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
|
||||||
|
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
|
||||||
|
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
|
||||||
|
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
|
||||||
|
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
|
||||||
|
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
|
||||||
|
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
|
||||||
|
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Honeypot extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Makes Honeypot visible or not to human
|
||||||
|
*/
|
||||||
|
public bool $hidden = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot Label Content
|
||||||
|
*/
|
||||||
|
public string $label = 'Fill This Field';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot Field Name
|
||||||
|
*/
|
||||||
|
public string $name = 'honeypot';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot HTML Template
|
||||||
|
*/
|
||||||
|
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot container
|
||||||
|
*
|
||||||
|
* If you enabled CSP, you can remove `style="display:none"`.
|
||||||
|
*/
|
||||||
|
public string $container = '<div style="display:none">{template}</div>';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id attribute for Honeypot container tag
|
||||||
|
*
|
||||||
|
* Used when CSP is enabled.
|
||||||
|
*/
|
||||||
|
public string $containerId = 'hpc';
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Images\Handlers\GDHandler;
|
||||||
|
use CodeIgniter\Images\Handlers\ImageMagickHandler;
|
||||||
|
|
||||||
|
class Images extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Default handler used if no other handler is specified.
|
||||||
|
*/
|
||||||
|
public string $defaultHandler = 'gd';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path to the image library.
|
||||||
|
* Required for ImageMagick, GraphicsMagick, or NetPBM.
|
||||||
|
*/
|
||||||
|
public string $libraryPath = '/usr/local/bin/convert';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The available handler classes.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $handlers = [
|
||||||
|
'gd' => GDHandler::class,
|
||||||
|
'imagick' => ImageMagickHandler::class,
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use Kint\Parser\ConstructablePluginInterface;
|
||||||
|
use Kint\Renderer\AbstractRenderer;
|
||||||
|
use Kint\Renderer\Rich\TabPluginInterface;
|
||||||
|
use Kint\Renderer\Rich\ValuePluginInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Kint
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
|
||||||
|
* that you can set to customize how Kint works for you.
|
||||||
|
*
|
||||||
|
* @see https://kint-php.github.io/kint/ for details on these settings.
|
||||||
|
*/
|
||||||
|
class Kint
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>|null
|
||||||
|
*/
|
||||||
|
public $plugins;
|
||||||
|
|
||||||
|
public int $maxDepth = 6;
|
||||||
|
public bool $displayCalledFrom = true;
|
||||||
|
public bool $expanded = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| RichRenderer Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
public string $richTheme = 'aante-light.css';
|
||||||
|
public bool $richFolder = false;
|
||||||
|
public int $richSort = AbstractRenderer::SORT_FULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, class-string<ValuePluginInterface>>|null
|
||||||
|
*/
|
||||||
|
public $richObjectPlugins;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, class-string<TabPluginInterface>>|null
|
||||||
|
*/
|
||||||
|
public $richTabPlugins;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| CLI Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
public bool $cliColors = true;
|
||||||
|
public bool $cliForceUTF8 = false;
|
||||||
|
public bool $cliDetectWidth = true;
|
||||||
|
public int $cliMinWidth = 40;
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Log\Handlers\FileHandler;
|
||||||
|
|
||||||
|
class Logger extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Error Logging Threshold
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* You can enable error logging by setting a threshold over zero. The
|
||||||
|
* threshold determines what gets logged. Any values below or equal to the
|
||||||
|
* threshold will be logged.
|
||||||
|
*
|
||||||
|
* Threshold options are:
|
||||||
|
*
|
||||||
|
* - 0 = Disables logging, Error logging TURNED OFF
|
||||||
|
* - 1 = Emergency Messages - System is unusable
|
||||||
|
* - 2 = Alert Messages - Action Must Be Taken Immediately
|
||||||
|
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
|
||||||
|
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
|
||||||
|
* - 5 = Warnings - Exceptional occurrences that are not errors.
|
||||||
|
* - 6 = Notices - Normal but significant events.
|
||||||
|
* - 7 = Info - Interesting events, like user logging in, etc.
|
||||||
|
* - 8 = Debug - Detailed debug information.
|
||||||
|
* - 9 = All Messages
|
||||||
|
*
|
||||||
|
* You can also pass an array with threshold levels to show individual error types
|
||||||
|
*
|
||||||
|
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
|
||||||
|
*
|
||||||
|
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
|
||||||
|
* your log files will fill up very fast.
|
||||||
|
*
|
||||||
|
* @var int|list<int>
|
||||||
|
*/
|
||||||
|
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Date Format for Logs
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Each item that is logged has an associated date. You can use PHP date
|
||||||
|
* codes to set your own date formatting
|
||||||
|
*/
|
||||||
|
public string $dateFormat = 'Y-m-d H:i:s';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Log Handlers
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The logging system supports multiple actions to be taken when something
|
||||||
|
* is logged. This is done by allowing for multiple Handlers, special classes
|
||||||
|
* designed to write the log to their chosen destinations, whether that is
|
||||||
|
* a file on the getServer, a cloud-based service, or even taking actions such
|
||||||
|
* as emailing the dev team.
|
||||||
|
*
|
||||||
|
* Each handler is defined by the class name used for that handler, and it
|
||||||
|
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
|
||||||
|
*
|
||||||
|
* The value of each key is an array of configuration items that are sent
|
||||||
|
* to the constructor of each handler. The only required configuration item
|
||||||
|
* is the 'handles' element, which must be an array of integer log levels.
|
||||||
|
* This is most easily handled by using the constants defined in the
|
||||||
|
* `Psr\Log\LogLevel` class.
|
||||||
|
*
|
||||||
|
* Handlers are executed in the order defined in this array, starting with
|
||||||
|
* the handler on top and continuing down.
|
||||||
|
*
|
||||||
|
* @var array<class-string, array<string, int|list<string>|string>>
|
||||||
|
*/
|
||||||
|
public array $handlers = [
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* File Handler
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
FileHandler::class => [
|
||||||
|
// The log levels that this handler will handle.
|
||||||
|
'handles' => [
|
||||||
|
'critical',
|
||||||
|
'alert',
|
||||||
|
'emergency',
|
||||||
|
'debug',
|
||||||
|
'error',
|
||||||
|
'info',
|
||||||
|
'notice',
|
||||||
|
'warning',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The default filename extension for log files.
|
||||||
|
* An extension of 'php' allows for protecting the log files via basic
|
||||||
|
* scripting, when they are to be stored under a publicly accessible directory.
|
||||||
|
*
|
||||||
|
* NOTE: Leaving it blank will default to 'log'.
|
||||||
|
*/
|
||||||
|
'fileExtension' => '',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The file system permissions to be applied on newly created log files.
|
||||||
|
*
|
||||||
|
* IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
|
||||||
|
* integer notation (i.e. 0700, 0644, etc.)
|
||||||
|
*/
|
||||||
|
'filePermissions' => 0644,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Logging Directory Path
|
||||||
|
*
|
||||||
|
* By default, logs are written to WRITEPATH . 'logs/'
|
||||||
|
* Specify a different destination here, if desired.
|
||||||
|
*/
|
||||||
|
'path' => '',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The ChromeLoggerHandler requires the use of the Chrome web browser
|
||||||
|
* and the ChromeLogger extension. Uncomment this block to use it.
|
||||||
|
*/
|
||||||
|
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
|
||||||
|
// /*
|
||||||
|
// * The log levels that this handler will handle.
|
||||||
|
// */
|
||||||
|
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
|
||||||
|
// 'error', 'info', 'notice', 'warning'],
|
||||||
|
// ],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
|
||||||
|
* Uncomment this block to use it.
|
||||||
|
*/
|
||||||
|
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
|
||||||
|
// /* The log levels this handler can handle. */
|
||||||
|
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
|
||||||
|
//
|
||||||
|
// /*
|
||||||
|
// * The message type where the error should go. Can be 0 or 4, or use the
|
||||||
|
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
|
||||||
|
// */
|
||||||
|
// 'messageType' => 0,
|
||||||
|
// ],
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Migrations extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Enable/Disable Migrations
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Migrations are enabled by default.
|
||||||
|
*
|
||||||
|
* You should enable migrations whenever you intend to do a schema migration
|
||||||
|
* and disable it back when you're done.
|
||||||
|
*/
|
||||||
|
public bool $enabled = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Migrations Table
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This is the name of the table that will store the current migrations state.
|
||||||
|
* When migrations runs it will store in a database table which migration
|
||||||
|
* files have already been run.
|
||||||
|
*/
|
||||||
|
public string $table = 'migrations';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Timestamp Format
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This is the format that will be used when creating new migrations
|
||||||
|
* using the CLI command:
|
||||||
|
* > php spark make:migration
|
||||||
|
*
|
||||||
|
* NOTE: if you set an unsupported format, migration runner will not find
|
||||||
|
* your migration files.
|
||||||
|
*
|
||||||
|
* Supported formats:
|
||||||
|
* - YmdHis_
|
||||||
|
* - Y-m-d-His_
|
||||||
|
* - Y_m_d_His_
|
||||||
|
*/
|
||||||
|
public string $timestampFormat = 'Y-m-d-His_';
|
||||||
|
}
|
|
@ -0,0 +1,536 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mimes
|
||||||
|
*
|
||||||
|
* This file contains an array of mime types. It is used by the
|
||||||
|
* Upload class to help identify allowed file types.
|
||||||
|
*
|
||||||
|
* When more than one variation for an extension exist (like jpg, jpeg, etc)
|
||||||
|
* the most common one should be first in the array to aid the guess*
|
||||||
|
* methods. The same applies when more than one mime-type exists for a
|
||||||
|
* single extension.
|
||||||
|
*
|
||||||
|
* When working with mime types, please make sure you have the ´fileinfo´
|
||||||
|
* extension enabled to reliably detect the media types.
|
||||||
|
*
|
||||||
|
* @immutable
|
||||||
|
*/
|
||||||
|
class Mimes
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Map of extensions to mime types.
|
||||||
|
*
|
||||||
|
* @var array<string, list<string>|string>
|
||||||
|
*/
|
||||||
|
public static array $mimes = [
|
||||||
|
'hqx' => [
|
||||||
|
'application/mac-binhex40',
|
||||||
|
'application/mac-binhex',
|
||||||
|
'application/x-binhex40',
|
||||||
|
'application/x-mac-binhex40',
|
||||||
|
],
|
||||||
|
'cpt' => 'application/mac-compactpro',
|
||||||
|
'csv' => [
|
||||||
|
'text/csv',
|
||||||
|
'text/x-comma-separated-values',
|
||||||
|
'text/comma-separated-values',
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/x-csv',
|
||||||
|
'text/x-csv',
|
||||||
|
'application/csv',
|
||||||
|
'application/excel',
|
||||||
|
'application/vnd.msexcel',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'bin' => [
|
||||||
|
'application/macbinary',
|
||||||
|
'application/mac-binary',
|
||||||
|
'application/octet-stream',
|
||||||
|
'application/x-binary',
|
||||||
|
'application/x-macbinary',
|
||||||
|
],
|
||||||
|
'dms' => 'application/octet-stream',
|
||||||
|
'lha' => 'application/octet-stream',
|
||||||
|
'lzh' => 'application/octet-stream',
|
||||||
|
'exe' => [
|
||||||
|
'application/octet-stream',
|
||||||
|
'application/vnd.microsoft.portable-executable',
|
||||||
|
'application/x-dosexec',
|
||||||
|
'application/x-msdownload',
|
||||||
|
],
|
||||||
|
'class' => 'application/octet-stream',
|
||||||
|
'psd' => [
|
||||||
|
'application/x-photoshop',
|
||||||
|
'image/vnd.adobe.photoshop',
|
||||||
|
],
|
||||||
|
'so' => 'application/octet-stream',
|
||||||
|
'sea' => 'application/octet-stream',
|
||||||
|
'dll' => 'application/octet-stream',
|
||||||
|
'oda' => 'application/oda',
|
||||||
|
'pdf' => [
|
||||||
|
'application/pdf',
|
||||||
|
'application/force-download',
|
||||||
|
'application/x-download',
|
||||||
|
],
|
||||||
|
'ai' => [
|
||||||
|
'application/pdf',
|
||||||
|
'application/postscript',
|
||||||
|
],
|
||||||
|
'eps' => 'application/postscript',
|
||||||
|
'ps' => 'application/postscript',
|
||||||
|
'smi' => 'application/smil',
|
||||||
|
'smil' => 'application/smil',
|
||||||
|
'mif' => 'application/vnd.mif',
|
||||||
|
'xls' => [
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/msexcel',
|
||||||
|
'application/x-msexcel',
|
||||||
|
'application/x-ms-excel',
|
||||||
|
'application/x-excel',
|
||||||
|
'application/x-dos_ms_excel',
|
||||||
|
'application/xls',
|
||||||
|
'application/x-xls',
|
||||||
|
'application/excel',
|
||||||
|
'application/download',
|
||||||
|
'application/vnd.ms-office',
|
||||||
|
'application/msword',
|
||||||
|
],
|
||||||
|
'ppt' => [
|
||||||
|
'application/vnd.ms-powerpoint',
|
||||||
|
'application/powerpoint',
|
||||||
|
'application/vnd.ms-office',
|
||||||
|
'application/msword',
|
||||||
|
],
|
||||||
|
'pptx' => [
|
||||||
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||||
|
],
|
||||||
|
'wbxml' => 'application/wbxml',
|
||||||
|
'wmlc' => 'application/wmlc',
|
||||||
|
'dcr' => 'application/x-director',
|
||||||
|
'dir' => 'application/x-director',
|
||||||
|
'dxr' => 'application/x-director',
|
||||||
|
'dvi' => 'application/x-dvi',
|
||||||
|
'gtar' => 'application/x-gtar',
|
||||||
|
'gz' => 'application/x-gzip',
|
||||||
|
'gzip' => 'application/x-gzip',
|
||||||
|
'php' => [
|
||||||
|
'application/x-php',
|
||||||
|
'application/x-httpd-php',
|
||||||
|
'application/php',
|
||||||
|
'text/php',
|
||||||
|
'text/x-php',
|
||||||
|
'application/x-httpd-php-source',
|
||||||
|
],
|
||||||
|
'php4' => 'application/x-httpd-php',
|
||||||
|
'php3' => 'application/x-httpd-php',
|
||||||
|
'phtml' => 'application/x-httpd-php',
|
||||||
|
'phps' => 'application/x-httpd-php-source',
|
||||||
|
'js' => [
|
||||||
|
'application/x-javascript',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'swf' => 'application/x-shockwave-flash',
|
||||||
|
'sit' => 'application/x-stuffit',
|
||||||
|
'tar' => 'application/x-tar',
|
||||||
|
'tgz' => [
|
||||||
|
'application/x-tar',
|
||||||
|
'application/x-gzip-compressed',
|
||||||
|
],
|
||||||
|
'z' => 'application/x-compress',
|
||||||
|
'xhtml' => 'application/xhtml+xml',
|
||||||
|
'xht' => 'application/xhtml+xml',
|
||||||
|
'zip' => [
|
||||||
|
'application/x-zip',
|
||||||
|
'application/zip',
|
||||||
|
'application/x-zip-compressed',
|
||||||
|
'application/s-compressed',
|
||||||
|
'multipart/x-zip',
|
||||||
|
],
|
||||||
|
'rar' => [
|
||||||
|
'application/vnd.rar',
|
||||||
|
'application/x-rar',
|
||||||
|
'application/rar',
|
||||||
|
'application/x-rar-compressed',
|
||||||
|
],
|
||||||
|
'mid' => 'audio/midi',
|
||||||
|
'midi' => 'audio/midi',
|
||||||
|
'mpga' => 'audio/mpeg',
|
||||||
|
'mp2' => 'audio/mpeg',
|
||||||
|
'mp3' => [
|
||||||
|
'audio/mpeg',
|
||||||
|
'audio/mpg',
|
||||||
|
'audio/mpeg3',
|
||||||
|
'audio/mp3',
|
||||||
|
],
|
||||||
|
'aif' => [
|
||||||
|
'audio/x-aiff',
|
||||||
|
'audio/aiff',
|
||||||
|
],
|
||||||
|
'aiff' => [
|
||||||
|
'audio/x-aiff',
|
||||||
|
'audio/aiff',
|
||||||
|
],
|
||||||
|
'aifc' => 'audio/x-aiff',
|
||||||
|
'ram' => 'audio/x-pn-realaudio',
|
||||||
|
'rm' => 'audio/x-pn-realaudio',
|
||||||
|
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||||
|
'ra' => 'audio/x-realaudio',
|
||||||
|
'rv' => 'video/vnd.rn-realvideo',
|
||||||
|
'wav' => [
|
||||||
|
'audio/x-wav',
|
||||||
|
'audio/wave',
|
||||||
|
'audio/wav',
|
||||||
|
],
|
||||||
|
'bmp' => [
|
||||||
|
'image/bmp',
|
||||||
|
'image/x-bmp',
|
||||||
|
'image/x-bitmap',
|
||||||
|
'image/x-xbitmap',
|
||||||
|
'image/x-win-bitmap',
|
||||||
|
'image/x-windows-bmp',
|
||||||
|
'image/ms-bmp',
|
||||||
|
'image/x-ms-bmp',
|
||||||
|
'application/bmp',
|
||||||
|
'application/x-bmp',
|
||||||
|
'application/x-win-bitmap',
|
||||||
|
],
|
||||||
|
'gif' => 'image/gif',
|
||||||
|
'jpg' => [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/pjpeg',
|
||||||
|
],
|
||||||
|
'jpeg' => [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/pjpeg',
|
||||||
|
],
|
||||||
|
'jpe' => [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/pjpeg',
|
||||||
|
],
|
||||||
|
'jp2' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'j2k' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'jpf' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'jpg2' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'jpx' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'jpm' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'mj2' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'mjp2' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'png' => [
|
||||||
|
'image/png',
|
||||||
|
'image/x-png',
|
||||||
|
],
|
||||||
|
'webp' => 'image/webp',
|
||||||
|
'tif' => 'image/tiff',
|
||||||
|
'tiff' => 'image/tiff',
|
||||||
|
'css' => [
|
||||||
|
'text/css',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'html' => [
|
||||||
|
'text/html',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'htm' => [
|
||||||
|
'text/html',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'shtml' => [
|
||||||
|
'text/html',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'txt' => 'text/plain',
|
||||||
|
'text' => 'text/plain',
|
||||||
|
'log' => [
|
||||||
|
'text/plain',
|
||||||
|
'text/x-log',
|
||||||
|
],
|
||||||
|
'rtx' => 'text/richtext',
|
||||||
|
'rtf' => 'text/rtf',
|
||||||
|
'xml' => [
|
||||||
|
'application/xml',
|
||||||
|
'text/xml',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'xsl' => [
|
||||||
|
'application/xml',
|
||||||
|
'text/xsl',
|
||||||
|
'text/xml',
|
||||||
|
],
|
||||||
|
'mpeg' => 'video/mpeg',
|
||||||
|
'mpg' => 'video/mpeg',
|
||||||
|
'mpe' => 'video/mpeg',
|
||||||
|
'qt' => 'video/quicktime',
|
||||||
|
'mov' => 'video/quicktime',
|
||||||
|
'avi' => [
|
||||||
|
'video/x-msvideo',
|
||||||
|
'video/msvideo',
|
||||||
|
'video/avi',
|
||||||
|
'application/x-troff-msvideo',
|
||||||
|
],
|
||||||
|
'movie' => 'video/x-sgi-movie',
|
||||||
|
'doc' => [
|
||||||
|
'application/msword',
|
||||||
|
'application/vnd.ms-office',
|
||||||
|
],
|
||||||
|
'docx' => [
|
||||||
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
|
'application/zip',
|
||||||
|
'application/msword',
|
||||||
|
'application/x-zip',
|
||||||
|
],
|
||||||
|
'dot' => [
|
||||||
|
'application/msword',
|
||||||
|
'application/vnd.ms-office',
|
||||||
|
],
|
||||||
|
'dotx' => [
|
||||||
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
|
'application/zip',
|
||||||
|
'application/msword',
|
||||||
|
],
|
||||||
|
'xlsx' => [
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
'application/zip',
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/msword',
|
||||||
|
'application/x-zip',
|
||||||
|
],
|
||||||
|
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
||||||
|
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
|
||||||
|
'word' => [
|
||||||
|
'application/msword',
|
||||||
|
'application/octet-stream',
|
||||||
|
],
|
||||||
|
'xl' => 'application/excel',
|
||||||
|
'eml' => 'message/rfc822',
|
||||||
|
'json' => [
|
||||||
|
'application/json',
|
||||||
|
'text/json',
|
||||||
|
],
|
||||||
|
'pem' => [
|
||||||
|
'application/x-x509-user-cert',
|
||||||
|
'application/x-pem-file',
|
||||||
|
'application/octet-stream',
|
||||||
|
],
|
||||||
|
'p10' => [
|
||||||
|
'application/x-pkcs10',
|
||||||
|
'application/pkcs10',
|
||||||
|
],
|
||||||
|
'p12' => 'application/x-pkcs12',
|
||||||
|
'p7a' => 'application/x-pkcs7-signature',
|
||||||
|
'p7c' => [
|
||||||
|
'application/pkcs7-mime',
|
||||||
|
'application/x-pkcs7-mime',
|
||||||
|
],
|
||||||
|
'p7m' => [
|
||||||
|
'application/pkcs7-mime',
|
||||||
|
'application/x-pkcs7-mime',
|
||||||
|
],
|
||||||
|
'p7r' => 'application/x-pkcs7-certreqresp',
|
||||||
|
'p7s' => 'application/pkcs7-signature',
|
||||||
|
'crt' => [
|
||||||
|
'application/x-x509-ca-cert',
|
||||||
|
'application/x-x509-user-cert',
|
||||||
|
'application/pkix-cert',
|
||||||
|
],
|
||||||
|
'crl' => [
|
||||||
|
'application/pkix-crl',
|
||||||
|
'application/pkcs-crl',
|
||||||
|
],
|
||||||
|
'der' => 'application/x-x509-ca-cert',
|
||||||
|
'kdb' => 'application/octet-stream',
|
||||||
|
'pgp' => 'application/pgp',
|
||||||
|
'gpg' => 'application/gpg-keys',
|
||||||
|
'sst' => 'application/octet-stream',
|
||||||
|
'csr' => 'application/octet-stream',
|
||||||
|
'rsa' => 'application/x-pkcs7',
|
||||||
|
'cer' => [
|
||||||
|
'application/pkix-cert',
|
||||||
|
'application/x-x509-ca-cert',
|
||||||
|
],
|
||||||
|
'3g2' => 'video/3gpp2',
|
||||||
|
'3gp' => [
|
||||||
|
'video/3gp',
|
||||||
|
'video/3gpp',
|
||||||
|
],
|
||||||
|
'mp4' => 'video/mp4',
|
||||||
|
'm4a' => 'audio/x-m4a',
|
||||||
|
'f4v' => [
|
||||||
|
'video/mp4',
|
||||||
|
'video/x-f4v',
|
||||||
|
],
|
||||||
|
'flv' => 'video/x-flv',
|
||||||
|
'webm' => 'video/webm',
|
||||||
|
'aac' => 'audio/x-acc',
|
||||||
|
'm4u' => 'application/vnd.mpegurl',
|
||||||
|
'm3u' => 'text/plain',
|
||||||
|
'xspf' => 'application/xspf+xml',
|
||||||
|
'vlc' => 'application/videolan',
|
||||||
|
'wmv' => [
|
||||||
|
'video/x-ms-wmv',
|
||||||
|
'video/x-ms-asf',
|
||||||
|
],
|
||||||
|
'au' => 'audio/x-au',
|
||||||
|
'ac3' => 'audio/ac3',
|
||||||
|
'flac' => 'audio/x-flac',
|
||||||
|
'ogg' => [
|
||||||
|
'audio/ogg',
|
||||||
|
'video/ogg',
|
||||||
|
'application/ogg',
|
||||||
|
],
|
||||||
|
'kmz' => [
|
||||||
|
'application/vnd.google-earth.kmz',
|
||||||
|
'application/zip',
|
||||||
|
'application/x-zip',
|
||||||
|
],
|
||||||
|
'kml' => [
|
||||||
|
'application/vnd.google-earth.kml+xml',
|
||||||
|
'application/xml',
|
||||||
|
'text/xml',
|
||||||
|
],
|
||||||
|
'ics' => 'text/calendar',
|
||||||
|
'ical' => 'text/calendar',
|
||||||
|
'zsh' => 'text/x-scriptzsh',
|
||||||
|
'7zip' => [
|
||||||
|
'application/x-compressed',
|
||||||
|
'application/x-zip-compressed',
|
||||||
|
'application/zip',
|
||||||
|
'multipart/x-zip',
|
||||||
|
],
|
||||||
|
'cdr' => [
|
||||||
|
'application/cdr',
|
||||||
|
'application/coreldraw',
|
||||||
|
'application/x-cdr',
|
||||||
|
'application/x-coreldraw',
|
||||||
|
'image/cdr',
|
||||||
|
'image/x-cdr',
|
||||||
|
'zz-application/zz-winassoc-cdr',
|
||||||
|
],
|
||||||
|
'wma' => [
|
||||||
|
'audio/x-ms-wma',
|
||||||
|
'video/x-ms-asf',
|
||||||
|
],
|
||||||
|
'jar' => [
|
||||||
|
'application/java-archive',
|
||||||
|
'application/x-java-application',
|
||||||
|
'application/x-jar',
|
||||||
|
'application/x-compressed',
|
||||||
|
],
|
||||||
|
'svg' => [
|
||||||
|
'image/svg+xml',
|
||||||
|
'image/svg',
|
||||||
|
'application/xml',
|
||||||
|
'text/xml',
|
||||||
|
],
|
||||||
|
'vcf' => 'text/x-vcard',
|
||||||
|
'srt' => [
|
||||||
|
'text/srt',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'vtt' => [
|
||||||
|
'text/vtt',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'ico' => [
|
||||||
|
'image/x-icon',
|
||||||
|
'image/x-ico',
|
||||||
|
'image/vnd.microsoft.icon',
|
||||||
|
],
|
||||||
|
'stl' => [
|
||||||
|
'application/sla',
|
||||||
|
'application/vnd.ms-pki.stl',
|
||||||
|
'application/x-navistyle',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to determine the best mime type for the given file extension.
|
||||||
|
*
|
||||||
|
* @return string|null The mime type found, or none if unable to determine.
|
||||||
|
*/
|
||||||
|
public static function guessTypeFromExtension(string $extension)
|
||||||
|
{
|
||||||
|
$extension = trim(strtolower($extension), '. ');
|
||||||
|
|
||||||
|
if (! array_key_exists($extension, static::$mimes)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to determine the best file extension for a given mime type.
|
||||||
|
*
|
||||||
|
* @param string|null $proposedExtension - default extension (in case there is more than one with the same mime type)
|
||||||
|
*
|
||||||
|
* @return string|null The extension determined, or null if unable to match.
|
||||||
|
*/
|
||||||
|
public static function guessExtensionFromType(string $type, ?string $proposedExtension = null)
|
||||||
|
{
|
||||||
|
$type = trim(strtolower($type), '. ');
|
||||||
|
|
||||||
|
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
|
||||||
|
|
||||||
|
if (
|
||||||
|
$proposedExtension !== ''
|
||||||
|
&& array_key_exists($proposedExtension, static::$mimes)
|
||||||
|
&& in_array($type, (array) static::$mimes[$proposedExtension], true)
|
||||||
|
) {
|
||||||
|
// The detected mime type matches with the proposed extension.
|
||||||
|
return $proposedExtension;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reverse check the mime type list if no extension was proposed.
|
||||||
|
// This search is order sensitive!
|
||||||
|
foreach (static::$mimes as $ext => $types) {
|
||||||
|
if (in_array($type, (array) $types, true)) {
|
||||||
|
return $ext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Modules\Modules as BaseModules;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modules Configuration.
|
||||||
|
*
|
||||||
|
* NOTE: This class is required prior to Autoloader instantiation,
|
||||||
|
* and does not extend BaseConfig.
|
||||||
|
*
|
||||||
|
* @immutable
|
||||||
|
*/
|
||||||
|
class Modules extends BaseModules
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Enable Auto-Discovery?
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If true, then auto-discovery will happen across all elements listed in
|
||||||
|
* $aliases below. If false, no auto-discovery will happen at all,
|
||||||
|
* giving a slight performance boost.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $enabled = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Enable Auto-Discovery Within Composer Packages?
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If true, then auto-discovery will happen across all namespaces loaded
|
||||||
|
* by Composer, as well as the namespaces configured locally.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $discoverInComposer = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Composer package list for Auto-Discovery
|
||||||
|
* This setting is optional.
|
||||||
|
*
|
||||||
|
* E.g.:
|
||||||
|
* [
|
||||||
|
* 'only' => [
|
||||||
|
* // List up all packages to auto-discover
|
||||||
|
* 'codeigniter4/shield',
|
||||||
|
* ],
|
||||||
|
* ]
|
||||||
|
* or
|
||||||
|
* [
|
||||||
|
* 'exclude' => [
|
||||||
|
* // List up packages to exclude.
|
||||||
|
* 'pestphp/pest',
|
||||||
|
* ],
|
||||||
|
* ]
|
||||||
|
*
|
||||||
|
* @var array{only?: list<string>, exclude?: list<string>}
|
||||||
|
*/
|
||||||
|
public $composerPackages = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Auto-Discovery Rules
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Aliases list of all discovery classes that will be active and used during
|
||||||
|
* the current application request.
|
||||||
|
*
|
||||||
|
* If it is not listed, only the base application elements will be used.
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public $aliases = [
|
||||||
|
'events',
|
||||||
|
'filters',
|
||||||
|
'registrars',
|
||||||
|
'routes',
|
||||||
|
'services',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optimization Configuration.
|
||||||
|
*
|
||||||
|
* NOTE: This class does not extend BaseConfig for performance reasons.
|
||||||
|
* So you cannot replace the property values with Environment Variables.
|
||||||
|
*
|
||||||
|
* @immutable
|
||||||
|
*/
|
||||||
|
class Optimize
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Config Caching
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* @see https://codeigniter.com/user_guide/concepts/factories.html#config-caching
|
||||||
|
*/
|
||||||
|
public bool $configCacheEnabled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Config Caching
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* @see https://codeigniter.com/user_guide/concepts/autoloader.html#file-locator-caching
|
||||||
|
*/
|
||||||
|
public bool $locatorCacheEnabled = false;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Pager extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Templates
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Pagination links are rendered out using views to configure their
|
||||||
|
* appearance. This array contains aliases and the view names to
|
||||||
|
* use when rendering the links.
|
||||||
|
*
|
||||||
|
* Within each view, the Pager object will be available as $pager,
|
||||||
|
* and the desired group as $pagerGroup;
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $templates = [
|
||||||
|
'default_full' => 'CodeIgniter\Pager\Views\default_full',
|
||||||
|
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
|
||||||
|
'default_head' => 'CodeIgniter\Pager\Views\default_head',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Items Per Page
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The default number of results shown in a single page.
|
||||||
|
*/
|
||||||
|
public int $perPage = 20;
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paths
|
||||||
|
*
|
||||||
|
* Holds the paths that are used by the system to
|
||||||
|
* locate the main directories, app, system, etc.
|
||||||
|
*
|
||||||
|
* Modifying these allows you to restructure your application,
|
||||||
|
* share a system folder between multiple applications, and more.
|
||||||
|
*
|
||||||
|
* All paths are relative to the project's root folder.
|
||||||
|
*/
|
||||||
|
class Paths
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* SYSTEM FOLDER NAME
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This must contain the name of your "system" folder. Include
|
||||||
|
* the path if the folder is not in the same directory as this file.
|
||||||
|
*/
|
||||||
|
public string $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* APPLICATION FOLDER NAME
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If you want this front controller to use a different "app"
|
||||||
|
* folder than the default one you can set its name here. The folder
|
||||||
|
* can also be renamed or relocated anywhere on your server. If
|
||||||
|
* you do, use a full server path.
|
||||||
|
*
|
||||||
|
* @see http://codeigniter.com/user_guide/general/managing_apps.html
|
||||||
|
*/
|
||||||
|
public string $appDirectory = __DIR__ . '/..';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* WRITABLE DIRECTORY NAME
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This variable must contain the name of your "writable" directory.
|
||||||
|
* The writable directory allows you to group all directories that
|
||||||
|
* need write permission to a single place that can be tucked away
|
||||||
|
* for maximum security, keeping it out of the app and/or
|
||||||
|
* system directories.
|
||||||
|
*/
|
||||||
|
public string $writableDirectory = __DIR__ . '/../../writable';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* TESTS DIRECTORY NAME
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This variable must contain the name of your "tests" directory.
|
||||||
|
*/
|
||||||
|
public string $testsDirectory = __DIR__ . '/../../tests';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* VIEW DIRECTORY NAME
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This variable must contain the name of the directory that
|
||||||
|
* contains the view files used by your application. By
|
||||||
|
* default this is in `app/Views`. This value
|
||||||
|
* is used when no value is provided to `Services::renderer()`.
|
||||||
|
*/
|
||||||
|
public string $viewDirectory = __DIR__ . '/../Views';
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\Publisher as BasePublisher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publisher Configuration
|
||||||
|
*
|
||||||
|
* Defines basic security restrictions for the Publisher class
|
||||||
|
* to prevent abuse by injecting malicious files into a project.
|
||||||
|
*/
|
||||||
|
class Publisher extends BasePublisher
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A list of allowed destinations with a (pseudo-)regex
|
||||||
|
* of allowed files for each destination.
|
||||||
|
* Attempts to publish to directories not in this list will
|
||||||
|
* result in a PublisherException. Files that do no fit the
|
||||||
|
* pattern will cause copy/merge to fail.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public $restrictions = [
|
||||||
|
ROOTPATH => '*',
|
||||||
|
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use CodeIgniter\Router\RouteCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var RouteCollection $routes
|
||||||
|
*/
|
||||||
|
|
||||||
|
$routes->get('/', 'Home::index');
|
||||||
|
$routes->get('/paket', 'Home::paket');
|
||||||
|
$routes->get('/informasi', 'Home::informasi');
|
||||||
|
$routes->match(['GET', 'POST'], '/login', 'Authentication\AuthController::login');
|
||||||
|
$routes->match(['GET', 'POST'], '/register', 'Authentication\AuthController::register');
|
||||||
|
$routes->group('home', ['filter' => 'isAuthenticated', 'filter' => 'isAuthenticatedAs:pelanggan'], function($routes) {
|
||||||
|
$routes->get('logout', 'Authentication\AuthController::logout');
|
||||||
|
$routes->get('/', 'Home::index');
|
||||||
|
$routes->group('profile', function($routes) {
|
||||||
|
$routes->match(['GET', 'POST'], '(:num)', 'Home::profile/$1');
|
||||||
|
$routes->match(['POST'], 'password/(:num)', 'Home::password/$1');
|
||||||
|
});
|
||||||
|
$routes->group('transaksi/saya', function($routes) {
|
||||||
|
$routes->match(['GET', 'POST'], '(:num)', 'Dashboard\TransaksiController::transaksiSaya/$1');
|
||||||
|
$routes->match(['GET', 'POST'], 'bayar/(:num)', 'Dashboard\TransaksiController::bayarOnline/$1');
|
||||||
|
$routes->match(['GET', 'POST'], 'bayar/online', 'Dashboard\TransaksiController::updatePaymentStatus');
|
||||||
|
$routes->match(['GET'], 'detail/(:num)', 'Dashboard\TransaksiController::detailPelanggan/$1');
|
||||||
|
});
|
||||||
|
$routes->group('laporan/saya', function($routes) {
|
||||||
|
$routes->match(['GET'], '(:num)', 'TicketController::index/$1');
|
||||||
|
$routes->match(['GET'], 'delete/(:num)', 'TicketController::delete/$1');
|
||||||
|
$routes->match(['GET', 'POST'], 'create', 'TicketController::create');
|
||||||
|
$routes->match(['GET', 'POST'], 'update/(:num)', 'TicketController::update/$1');
|
||||||
|
});
|
||||||
|
$routes->group('lengkapi/informasi', function($routes) {
|
||||||
|
$routes->match(['GET', 'POST'], '(:num)', 'Dashboard\PelangganController::lengkapiInformasi/$1');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$routes->group('dashboard', ['filter' => 'isAuthenticated', 'filter' => 'isAuthenticatedAs:teknisi,admin'], function($routes) {
|
||||||
|
$routes->get('logout', 'Authentication\AuthController::logout');
|
||||||
|
$routes->get('/', 'Dashboard\DashboardController::index');
|
||||||
|
$routes->group('profile', function($routes) {
|
||||||
|
$routes->match(['GET', 'POST'], '(:num)', 'Dashboard\DashboardController::profile/$1');
|
||||||
|
$routes->match(['POST'], 'password/(:num)', 'Dashboard\DashboardController::password/$1');
|
||||||
|
});
|
||||||
|
$routes->group('jadwal', ['filter' => 'isAuthenticatedAs:admin,teknisi'], function($routes) {
|
||||||
|
$routes->match(['GET'], '/', 'Dashboard\JadwalController::index');
|
||||||
|
$routes->match(['GET', 'POST'], 'create', 'Dashboard\JadwalController::create');
|
||||||
|
$routes->match(['GET', 'POST'], 'update/(:num)', 'Dashboard\JadwalController::update/$1');
|
||||||
|
$routes->match(['GET'], 'delete/(:num)', 'Dashboard\JadwalController::delete/$1');
|
||||||
|
});
|
||||||
|
$routes->group('rekap/transaksi', ['filter' => 'isAuthenticatedAs:admin'], function($routes) {
|
||||||
|
$routes->match(['GET'], '/', 'Dashboard\LaporanController::index');
|
||||||
|
$routes->match(['GET', 'POST'], 'create', 'Dashboard\LaporanController::create');
|
||||||
|
$routes->match(['GET', 'POST'], 'update/(:num)', 'Dashboard\LaporanController::update/$1');
|
||||||
|
$routes->match(['GET'], 'delete/(:num)', 'Dashboard\LaporanController::delete/$1');
|
||||||
|
$routes->match(['GET'], 'export/(:num)', 'Dashboard\LaporanController::export/$1');
|
||||||
|
});
|
||||||
|
$routes->group('rekap/jadwal', ['filter' => 'isAuthenticatedAs:admin'], function($routes) {
|
||||||
|
$routes->match(['GET'], '/', 'Dashboard\LaporanController::indexJadwal');
|
||||||
|
$routes->match(['GET', 'POST'], 'create', 'Dashboard\LaporanController::createJadwal');
|
||||||
|
$routes->match(['GET', 'POST'], 'update/(:num)', 'Dashboard\LaporanController::updateJadwal/$1');
|
||||||
|
$routes->match(['GET'], 'delete/(:num)', 'Dashboard\LaporanController::deleteJadwal/$1');
|
||||||
|
$routes->match(['GET'], 'export/(:num)', 'Dashboard\LaporanController::exportJadwal/$1');
|
||||||
|
});
|
||||||
|
$routes->group('paket', ['filter' => 'isAuthenticatedAs:admin'], function($routes) {
|
||||||
|
$routes->match(['GET'], '/', 'Dashboard\PaketController::index');
|
||||||
|
$routes->match(['GET', 'POST'], 'create', 'Dashboard\PaketController::create');
|
||||||
|
$routes->match(['GET', 'POST'], 'update/(:num)', 'Dashboard\PaketController::update/$1');
|
||||||
|
$routes->match(['GET'], 'delete/(:num)', 'Dashboard\PaketController::delete/$1');
|
||||||
|
});
|
||||||
|
$routes->group('laporan', ['filter' => 'isAuthenticatedAs:admin'], function($routes) {
|
||||||
|
$routes->match(['GET'], '/', 'TicketController::indexAdmin');
|
||||||
|
$routes->match(['GET', 'POST'], 'create/jadwal/(:num)', 'TicketController::createAdmin/$1');
|
||||||
|
$routes->match(['GET', 'POST'], 'update/(:num)', 'TicketController::updateAdmin/$1');
|
||||||
|
$routes->match(['GET'], 'delete/(:num)', 'TicketController::delete/$1');
|
||||||
|
});
|
||||||
|
$routes->group('pelanggan', ['filter' => 'isAuthenticatedAs:admin'], function($routes) {
|
||||||
|
$routes->match(['GET'], '/', 'Dashboard\PelangganController::index');
|
||||||
|
$routes->match(['GET', 'POST'], 'create', 'Dashboard\PelangganController::create');
|
||||||
|
$routes->match(['GET', 'POST'], 'update/(:num)', 'Dashboard\PelangganController::update/$1');
|
||||||
|
$routes->match(['GET'], 'delete/(:num)', 'Dashboard\PelangganController::delete/$1');
|
||||||
|
$routes->group('tagihan/bulanan', ['filter' => 'isAuthenticatedAs:admin'], function($routes) {
|
||||||
|
$routes->match(['GET'], '(:num)', 'Dashboard\PelangganController::createTagihanBulanan/$1');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$routes->group('transaksi', ['filter' => 'isAuthenticatedAs:admin,pelanggan'], function($routes) {
|
||||||
|
$routes->match(['GET', 'POST'], 'detail/(:num)', 'Dashboard\TransaksiController::detail/$1');
|
||||||
|
$routes->match(['GET'], '/', 'Dashboard\TransaksiController::index');
|
||||||
|
$routes->match(['GET'], 'delete/(:num)', 'Dashboard\TransaksiController::delete/$1');
|
||||||
|
$routes->post('export', 'Dashboard\TransaksiController::export');
|
||||||
|
});
|
||||||
|
$routes->group('user', ['filter' => 'isAuthenticatedAs:admin'], function($routes) {
|
||||||
|
$routes->match(['GET'], '/', 'Dashboard\UserController::index');
|
||||||
|
$routes->match(['GET', 'POST'], 'create', 'Dashboard\UserController::create');
|
||||||
|
$routes->match(['GET', 'POST'], 'update/(:num)', 'Dashboard\UserController::update/$1');
|
||||||
|
$routes->match(['GET'], 'delete/(:num)', 'Dashboard\UserController::delete/$1');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,140 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\Routing as BaseRouting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Routing configuration
|
||||||
|
*/
|
||||||
|
class Routing extends BaseRouting
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* For Defined Routes.
|
||||||
|
* An array of files that contain route definitions.
|
||||||
|
* Route files are read in order, with the first match
|
||||||
|
* found taking precedence.
|
||||||
|
*
|
||||||
|
* Default: APPPATH . 'Config/Routes.php'
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public array $routeFiles = [
|
||||||
|
APPPATH . 'Config/Routes.php',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Defined Routes and Auto Routing.
|
||||||
|
* The default namespace to use for Controllers when no other
|
||||||
|
* namespace has been specified.
|
||||||
|
*
|
||||||
|
* Default: 'App\Controllers'
|
||||||
|
*/
|
||||||
|
public string $defaultNamespace = 'App\Controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Auto Routing.
|
||||||
|
* The default controller to use when no other controller has been
|
||||||
|
* specified.
|
||||||
|
*
|
||||||
|
* Default: 'Home'
|
||||||
|
*/
|
||||||
|
public string $defaultController = 'Authentication\AuthController';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Defined Routes and Auto Routing.
|
||||||
|
* The default method to call on the controller when no other
|
||||||
|
* method has been set in the route.
|
||||||
|
*
|
||||||
|
* Default: 'index'
|
||||||
|
*/
|
||||||
|
public string $defaultMethod = 'index';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Auto Routing.
|
||||||
|
* Whether to translate dashes in URIs for controller/method to underscores.
|
||||||
|
* Primarily useful when using the auto-routing.
|
||||||
|
*
|
||||||
|
* Default: false
|
||||||
|
*/
|
||||||
|
public bool $translateURIDashes = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the class/method that should be called if routing doesn't
|
||||||
|
* find a match. It can be the controller/method name like: Users::index
|
||||||
|
*
|
||||||
|
* This setting is passed to the Router class and handled there.
|
||||||
|
*
|
||||||
|
* If you want to use a closure, you will have to set it in the
|
||||||
|
* routes file by calling:
|
||||||
|
*
|
||||||
|
* $routes->set404Override(function() {
|
||||||
|
* // Do something here
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* public $override404 = 'App\Errors::show404';
|
||||||
|
*/
|
||||||
|
public ?string $override404 = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If TRUE, the system will attempt to match the URI against
|
||||||
|
* Controllers by matching each segment against folders/files
|
||||||
|
* in APPPATH/Controllers, when a match wasn't found against
|
||||||
|
* defined routes.
|
||||||
|
*
|
||||||
|
* If FALSE, will stop searching and do NO automatic routing.
|
||||||
|
*/
|
||||||
|
public bool $autoRoute = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Defined Routes.
|
||||||
|
* If TRUE, will enable the use of the 'prioritize' option
|
||||||
|
* when defining routes.
|
||||||
|
*
|
||||||
|
* Default: false
|
||||||
|
*/
|
||||||
|
public bool $prioritize = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Defined Routes.
|
||||||
|
* If TRUE, matched multiple URI segments will be passed as one parameter.
|
||||||
|
*
|
||||||
|
* Default: false
|
||||||
|
*/
|
||||||
|
public bool $multipleSegmentsOneParam = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Auto Routing (Improved).
|
||||||
|
* Map of URI segments and namespaces.
|
||||||
|
*
|
||||||
|
* The key is the first URI segment. The value is the controller namespace.
|
||||||
|
* E.g.,
|
||||||
|
* [
|
||||||
|
* 'blog' => 'Acme\Blog\Controllers',
|
||||||
|
* ]
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $moduleRoutes = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Auto Routing (Improved).
|
||||||
|
* Whether to translate dashes in URIs for controller/method to CamelCase.
|
||||||
|
* E.g., blog-controller -> BlogController
|
||||||
|
*
|
||||||
|
* If you enable this, $translateURIDashes is ignored.
|
||||||
|
*
|
||||||
|
* Default: false
|
||||||
|
*/
|
||||||
|
public bool $translateUriToCamelCase = false;
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Security extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Protection Method
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Protection Method for Cross Site Request Forgery protection.
|
||||||
|
*
|
||||||
|
* @var string 'cookie' or 'session'
|
||||||
|
*/
|
||||||
|
public string $csrfProtection = 'cookie';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Token Randomization
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Randomize the CSRF Token for added security.
|
||||||
|
*/
|
||||||
|
public bool $tokenRandomize = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Token Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Token name for Cross Site Request Forgery protection.
|
||||||
|
*/
|
||||||
|
public string $tokenName = 'csrf_test_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Header Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Header name for Cross Site Request Forgery protection.
|
||||||
|
*/
|
||||||
|
public string $headerName = 'X-CSRF-TOKEN';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Cookie Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie name for Cross Site Request Forgery protection.
|
||||||
|
*/
|
||||||
|
public string $cookieName = 'csrf_cookie_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Expires
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Expiration time for Cross Site Request Forgery protection cookie.
|
||||||
|
*
|
||||||
|
* Defaults to two hours (in seconds).
|
||||||
|
*/
|
||||||
|
public int $expires = 7200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Regenerate
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Regenerate CSRF Token on every submission.
|
||||||
|
*/
|
||||||
|
public bool $regenerate = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Redirect
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Redirect to previous page with error on failure.
|
||||||
|
*
|
||||||
|
* @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
|
||||||
|
*/
|
||||||
|
public bool $redirect = (ENVIRONMENT === 'production');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF SameSite
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Setting for CSRF SameSite cookie token.
|
||||||
|
*
|
||||||
|
* Allowed values are: None - Lax - Strict - ''.
|
||||||
|
*
|
||||||
|
* Defaults to `Lax` as recommended in this link:
|
||||||
|
*
|
||||||
|
* @see https://portswigger.net/web-security/csrf/samesite-cookies
|
||||||
|
*
|
||||||
|
* @deprecated `Config\Cookie` $samesite property is used.
|
||||||
|
*/
|
||||||
|
public string $samesite = 'Lax';
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Services Configuration file.
|
||||||
|
*
|
||||||
|
* Services are simply other classes/libraries that the system uses
|
||||||
|
* to do its job. This is used by CodeIgniter to allow the core of the
|
||||||
|
* framework to be swapped out easily without affecting the usage within
|
||||||
|
* the rest of your application.
|
||||||
|
*
|
||||||
|
* This file holds any application-specific services, or service overrides
|
||||||
|
* that you might need. An example has been included with the general
|
||||||
|
* method format you should use for your service methods. For more examples,
|
||||||
|
* see the core Services file at system/Config/Services.php.
|
||||||
|
*/
|
||||||
|
class Services extends BaseService
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* public static function example($getShared = true)
|
||||||
|
* {
|
||||||
|
* if ($getShared) {
|
||||||
|
* return static::getSharedInstance('example');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* return new \CodeIgniter\Example();
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Session\Handlers\BaseHandler;
|
||||||
|
use CodeIgniter\Session\Handlers\FileHandler;
|
||||||
|
|
||||||
|
class Session extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Driver
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The session storage driver to use:
|
||||||
|
* - `CodeIgniter\Session\Handlers\FileHandler`
|
||||||
|
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
|
||||||
|
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
|
||||||
|
* - `CodeIgniter\Session\Handlers\RedisHandler`
|
||||||
|
*
|
||||||
|
* @var class-string<BaseHandler>
|
||||||
|
*/
|
||||||
|
public string $driver = FileHandler::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Cookie Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The session cookie name, must contain only [0-9a-z_-] characters
|
||||||
|
*/
|
||||||
|
public string $cookieName = 'ci_session';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Expiration
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The number of SECONDS you want the session to last.
|
||||||
|
* Setting to 0 (zero) means expire when the browser is closed.
|
||||||
|
*/
|
||||||
|
public int $expiration = 7200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Save Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The location to save sessions to and is driver dependent.
|
||||||
|
*
|
||||||
|
* For the 'files' driver, it's a path to a writable directory.
|
||||||
|
* WARNING: Only absolute paths are supported!
|
||||||
|
*
|
||||||
|
* For the 'database' driver, it's a table name.
|
||||||
|
* Please read up the manual for the format with other session drivers.
|
||||||
|
*
|
||||||
|
* IMPORTANT: You are REQUIRED to set a valid save path!
|
||||||
|
*/
|
||||||
|
public string $savePath = WRITEPATH . 'session';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Match IP
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Whether to match the user's IP address when reading the session data.
|
||||||
|
*
|
||||||
|
* WARNING: If you're using the database driver, don't forget to update
|
||||||
|
* your session table's PRIMARY KEY when changing this setting.
|
||||||
|
*/
|
||||||
|
public bool $matchIP = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Time to Update
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* How many seconds between CI regenerating the session ID.
|
||||||
|
*/
|
||||||
|
public int $timeToUpdate = 300;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Regenerate Destroy
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Whether to destroy session data associated with the old session ID
|
||||||
|
* when auto-regenerating the session ID. When set to FALSE, the data
|
||||||
|
* will be later deleted by the garbage collector.
|
||||||
|
*/
|
||||||
|
public bool $regenerateDestroy = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Database Group
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* DB Group for the database session.
|
||||||
|
*/
|
||||||
|
public ?string $DBGroup = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Lock Retry Interval (microseconds)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This is used for RedisHandler.
|
||||||
|
*
|
||||||
|
* Time (microseconds) to wait if lock cannot be acquired.
|
||||||
|
* The default is 100,000 microseconds (= 0.1 seconds).
|
||||||
|
*/
|
||||||
|
public int $lockRetryInterval = 100_000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Lock Max Retries
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This is used for RedisHandler.
|
||||||
|
*
|
||||||
|
* Maximum number of lock acquisition attempts.
|
||||||
|
* The default is 300 times. That is lock timeout is about 30 (0.1 * 300)
|
||||||
|
* seconds.
|
||||||
|
*/
|
||||||
|
public int $lockMaxRetries = 300;
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Database;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Events;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Files;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Views;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Debug Toolbar
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The Debug Toolbar provides a way to see information about the performance
|
||||||
|
* and state of your application during that page display. By default it will
|
||||||
|
* NOT be displayed under production environments, and will only display if
|
||||||
|
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
|
||||||
|
*/
|
||||||
|
class Toolbar extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Toolbar Collectors
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* List of toolbar collectors that will be called when Debug Toolbar
|
||||||
|
* fires up and collects data from.
|
||||||
|
*
|
||||||
|
* @var list<class-string>
|
||||||
|
*/
|
||||||
|
public array $collectors = [
|
||||||
|
Timers::class,
|
||||||
|
Database::class,
|
||||||
|
Logs::class,
|
||||||
|
Views::class,
|
||||||
|
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
|
||||||
|
Files::class,
|
||||||
|
Routes::class,
|
||||||
|
Events::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Collect Var Data
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If set to false var data from the views will not be collected. Useful to
|
||||||
|
* avoid high memory usage when there are lots of data passed to the view.
|
||||||
|
*/
|
||||||
|
public bool $collectVarData = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Max History
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* `$maxHistory` sets a limit on the number of past requests that are stored,
|
||||||
|
* helping to conserve file space used to store them. You can set it to
|
||||||
|
* 0 (zero) to not have any history stored, or -1 for unlimited history.
|
||||||
|
*/
|
||||||
|
public int $maxHistory = 20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Toolbar Views Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The full path to the the views that are used by the toolbar.
|
||||||
|
* This MUST have a trailing slash.
|
||||||
|
*/
|
||||||
|
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Max Queries
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If the Database Collector is enabled, it will log every query that the
|
||||||
|
* the system generates so they can be displayed on the toolbar's timeline
|
||||||
|
* and in the query log. This can lead to memory issues in some instances
|
||||||
|
* with hundreds of queries.
|
||||||
|
*
|
||||||
|
* `$maxQueries` defines the maximum amount of queries that will be stored.
|
||||||
|
*/
|
||||||
|
public int $maxQueries = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Watched Directories
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Contains an array of directories that will be watched for changes and
|
||||||
|
* used to determine if the hot-reload feature should reload the page or not.
|
||||||
|
* We restrict the values to keep performance as high as possible.
|
||||||
|
*
|
||||||
|
* NOTE: The ROOTPATH will be prepended to all values.
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public array $watchedDirectories = [
|
||||||
|
'app',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Watched File Extensions
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Contains an array of file extensions that will be watched for changes and
|
||||||
|
* used to determine if the hot-reload feature should reload the page or not.
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public array $watchedExtensions = [
|
||||||
|
'php', 'css', 'js', 'html', 'svg', 'json', 'env',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,252 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* User Agents
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This file contains four arrays of user agent data. It is used by the
|
||||||
|
* User Agent Class to help identify browser, platform, robot, and
|
||||||
|
* mobile device data. The array keys are used to identify the device
|
||||||
|
* and the array values are used to set the actual name of the item.
|
||||||
|
*/
|
||||||
|
class UserAgents extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* OS Platforms
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $platforms = [
|
||||||
|
'windows nt 10.0' => 'Windows 10',
|
||||||
|
'windows nt 6.3' => 'Windows 8.1',
|
||||||
|
'windows nt 6.2' => 'Windows 8',
|
||||||
|
'windows nt 6.1' => 'Windows 7',
|
||||||
|
'windows nt 6.0' => 'Windows Vista',
|
||||||
|
'windows nt 5.2' => 'Windows 2003',
|
||||||
|
'windows nt 5.1' => 'Windows XP',
|
||||||
|
'windows nt 5.0' => 'Windows 2000',
|
||||||
|
'windows nt 4.0' => 'Windows NT 4.0',
|
||||||
|
'winnt4.0' => 'Windows NT 4.0',
|
||||||
|
'winnt 4.0' => 'Windows NT',
|
||||||
|
'winnt' => 'Windows NT',
|
||||||
|
'windows 98' => 'Windows 98',
|
||||||
|
'win98' => 'Windows 98',
|
||||||
|
'windows 95' => 'Windows 95',
|
||||||
|
'win95' => 'Windows 95',
|
||||||
|
'windows phone' => 'Windows Phone',
|
||||||
|
'windows' => 'Unknown Windows OS',
|
||||||
|
'android' => 'Android',
|
||||||
|
'blackberry' => 'BlackBerry',
|
||||||
|
'iphone' => 'iOS',
|
||||||
|
'ipad' => 'iOS',
|
||||||
|
'ipod' => 'iOS',
|
||||||
|
'os x' => 'Mac OS X',
|
||||||
|
'ppc mac' => 'Power PC Mac',
|
||||||
|
'freebsd' => 'FreeBSD',
|
||||||
|
'ppc' => 'Macintosh',
|
||||||
|
'linux' => 'Linux',
|
||||||
|
'debian' => 'Debian',
|
||||||
|
'sunos' => 'Sun Solaris',
|
||||||
|
'beos' => 'BeOS',
|
||||||
|
'apachebench' => 'ApacheBench',
|
||||||
|
'aix' => 'AIX',
|
||||||
|
'irix' => 'Irix',
|
||||||
|
'osf' => 'DEC OSF',
|
||||||
|
'hp-ux' => 'HP-UX',
|
||||||
|
'netbsd' => 'NetBSD',
|
||||||
|
'bsdi' => 'BSDi',
|
||||||
|
'openbsd' => 'OpenBSD',
|
||||||
|
'gnu' => 'GNU/Linux',
|
||||||
|
'unix' => 'Unknown Unix OS',
|
||||||
|
'symbian' => 'Symbian OS',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* Browsers
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The order of this array should NOT be changed. Many browsers return
|
||||||
|
* multiple browser types so we want to identify the subtype first.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $browsers = [
|
||||||
|
'OPR' => 'Opera',
|
||||||
|
'Flock' => 'Flock',
|
||||||
|
'Edge' => 'Spartan',
|
||||||
|
'Edg' => 'Edge',
|
||||||
|
'Chrome' => 'Chrome',
|
||||||
|
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
|
||||||
|
'Opera.*?Version' => 'Opera',
|
||||||
|
'Opera' => 'Opera',
|
||||||
|
'MSIE' => 'Internet Explorer',
|
||||||
|
'Internet Explorer' => 'Internet Explorer',
|
||||||
|
'Trident.* rv' => 'Internet Explorer',
|
||||||
|
'Shiira' => 'Shiira',
|
||||||
|
'Firefox' => 'Firefox',
|
||||||
|
'Chimera' => 'Chimera',
|
||||||
|
'Phoenix' => 'Phoenix',
|
||||||
|
'Firebird' => 'Firebird',
|
||||||
|
'Camino' => 'Camino',
|
||||||
|
'Netscape' => 'Netscape',
|
||||||
|
'OmniWeb' => 'OmniWeb',
|
||||||
|
'Safari' => 'Safari',
|
||||||
|
'Mozilla' => 'Mozilla',
|
||||||
|
'Konqueror' => 'Konqueror',
|
||||||
|
'icab' => 'iCab',
|
||||||
|
'Lynx' => 'Lynx',
|
||||||
|
'Links' => 'Links',
|
||||||
|
'hotjava' => 'HotJava',
|
||||||
|
'amaya' => 'Amaya',
|
||||||
|
'IBrowse' => 'IBrowse',
|
||||||
|
'Maxthon' => 'Maxthon',
|
||||||
|
'Ubuntu' => 'Ubuntu Web Browser',
|
||||||
|
'Vivaldi' => 'Vivaldi',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* Mobiles
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $mobiles = [
|
||||||
|
// legacy array, old values commented out
|
||||||
|
'mobileexplorer' => 'Mobile Explorer',
|
||||||
|
// 'openwave' => 'Open Wave',
|
||||||
|
// 'opera mini' => 'Opera Mini',
|
||||||
|
// 'operamini' => 'Opera Mini',
|
||||||
|
// 'elaine' => 'Palm',
|
||||||
|
'palmsource' => 'Palm',
|
||||||
|
// 'digital paths' => 'Palm',
|
||||||
|
// 'avantgo' => 'Avantgo',
|
||||||
|
// 'xiino' => 'Xiino',
|
||||||
|
'palmscape' => 'Palmscape',
|
||||||
|
// 'nokia' => 'Nokia',
|
||||||
|
// 'ericsson' => 'Ericsson',
|
||||||
|
// 'blackberry' => 'BlackBerry',
|
||||||
|
// 'motorola' => 'Motorola'
|
||||||
|
|
||||||
|
// Phones and Manufacturers
|
||||||
|
'motorola' => 'Motorola',
|
||||||
|
'nokia' => 'Nokia',
|
||||||
|
'palm' => 'Palm',
|
||||||
|
'iphone' => 'Apple iPhone',
|
||||||
|
'ipad' => 'iPad',
|
||||||
|
'ipod' => 'Apple iPod Touch',
|
||||||
|
'sony' => 'Sony Ericsson',
|
||||||
|
'ericsson' => 'Sony Ericsson',
|
||||||
|
'blackberry' => 'BlackBerry',
|
||||||
|
'cocoon' => 'O2 Cocoon',
|
||||||
|
'blazer' => 'Treo',
|
||||||
|
'lg' => 'LG',
|
||||||
|
'amoi' => 'Amoi',
|
||||||
|
'xda' => 'XDA',
|
||||||
|
'mda' => 'MDA',
|
||||||
|
'vario' => 'Vario',
|
||||||
|
'htc' => 'HTC',
|
||||||
|
'samsung' => 'Samsung',
|
||||||
|
'sharp' => 'Sharp',
|
||||||
|
'sie-' => 'Siemens',
|
||||||
|
'alcatel' => 'Alcatel',
|
||||||
|
'benq' => 'BenQ',
|
||||||
|
'ipaq' => 'HP iPaq',
|
||||||
|
'mot-' => 'Motorola',
|
||||||
|
'playstation portable' => 'PlayStation Portable',
|
||||||
|
'playstation 3' => 'PlayStation 3',
|
||||||
|
'playstation vita' => 'PlayStation Vita',
|
||||||
|
'hiptop' => 'Danger Hiptop',
|
||||||
|
'nec-' => 'NEC',
|
||||||
|
'panasonic' => 'Panasonic',
|
||||||
|
'philips' => 'Philips',
|
||||||
|
'sagem' => 'Sagem',
|
||||||
|
'sanyo' => 'Sanyo',
|
||||||
|
'spv' => 'SPV',
|
||||||
|
'zte' => 'ZTE',
|
||||||
|
'sendo' => 'Sendo',
|
||||||
|
'nintendo dsi' => 'Nintendo DSi',
|
||||||
|
'nintendo ds' => 'Nintendo DS',
|
||||||
|
'nintendo 3ds' => 'Nintendo 3DS',
|
||||||
|
'wii' => 'Nintendo Wii',
|
||||||
|
'open web' => 'Open Web',
|
||||||
|
'openweb' => 'OpenWeb',
|
||||||
|
|
||||||
|
// Operating Systems
|
||||||
|
'android' => 'Android',
|
||||||
|
'symbian' => 'Symbian',
|
||||||
|
'SymbianOS' => 'SymbianOS',
|
||||||
|
'elaine' => 'Palm',
|
||||||
|
'series60' => 'Symbian S60',
|
||||||
|
'windows ce' => 'Windows CE',
|
||||||
|
|
||||||
|
// Browsers
|
||||||
|
'obigo' => 'Obigo',
|
||||||
|
'netfront' => 'Netfront Browser',
|
||||||
|
'openwave' => 'Openwave Browser',
|
||||||
|
'mobilexplorer' => 'Mobile Explorer',
|
||||||
|
'operamini' => 'Opera Mini',
|
||||||
|
'opera mini' => 'Opera Mini',
|
||||||
|
'opera mobi' => 'Opera Mobile',
|
||||||
|
'fennec' => 'Firefox Mobile',
|
||||||
|
|
||||||
|
// Other
|
||||||
|
'digital paths' => 'Digital Paths',
|
||||||
|
'avantgo' => 'AvantGo',
|
||||||
|
'xiino' => 'Xiino',
|
||||||
|
'novarra' => 'Novarra Transcoder',
|
||||||
|
'vodafone' => 'Vodafone',
|
||||||
|
'docomo' => 'NTT DoCoMo',
|
||||||
|
'o2' => 'O2',
|
||||||
|
|
||||||
|
// Fallback
|
||||||
|
'mobile' => 'Generic Mobile',
|
||||||
|
'wireless' => 'Generic Mobile',
|
||||||
|
'j2me' => 'Generic Mobile',
|
||||||
|
'midp' => 'Generic Mobile',
|
||||||
|
'cldc' => 'Generic Mobile',
|
||||||
|
'up.link' => 'Generic Mobile',
|
||||||
|
'up.browser' => 'Generic Mobile',
|
||||||
|
'smartphone' => 'Generic Mobile',
|
||||||
|
'cellphone' => 'Generic Mobile',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* Robots
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* There are hundred of bots but these are the most common.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $robots = [
|
||||||
|
'googlebot' => 'Googlebot',
|
||||||
|
'msnbot' => 'MSNBot',
|
||||||
|
'baiduspider' => 'Baiduspider',
|
||||||
|
'bingbot' => 'Bing',
|
||||||
|
'slurp' => 'Inktomi Slurp',
|
||||||
|
'yahoo' => 'Yahoo',
|
||||||
|
'ask jeeves' => 'Ask Jeeves',
|
||||||
|
'fastcrawler' => 'FastCrawler',
|
||||||
|
'infoseek' => 'InfoSeek Robot 1.0',
|
||||||
|
'lycos' => 'Lycos',
|
||||||
|
'yandex' => 'YandexBot',
|
||||||
|
'mediapartners-google' => 'MediaPartners Google',
|
||||||
|
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
|
||||||
|
'adsbot-google' => 'AdsBot Google',
|
||||||
|
'feedfetcher-google' => 'Feedfetcher Google',
|
||||||
|
'curious george' => 'Curious George',
|
||||||
|
'ia_archiver' => 'Alexa Crawler',
|
||||||
|
'MJ12bot' => 'Majestic-12',
|
||||||
|
'Uptimebot' => 'Uptimebot',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Validation\StrictRules\CreditCardRules;
|
||||||
|
use CodeIgniter\Validation\StrictRules\FileRules;
|
||||||
|
use CodeIgniter\Validation\StrictRules\FormatRules;
|
||||||
|
use CodeIgniter\Validation\StrictRules\Rules;
|
||||||
|
|
||||||
|
class Validation extends BaseConfig
|
||||||
|
{
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// Setup
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the classes that contain the
|
||||||
|
* rules that are available.
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
public array $ruleSets = [
|
||||||
|
Rules::class,
|
||||||
|
FormatRules::class,
|
||||||
|
FileRules::class,
|
||||||
|
CreditCardRules::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the views that are used to display the
|
||||||
|
* errors.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public array $templates = [
|
||||||
|
'list' => 'CodeIgniter\Validation\Views\list',
|
||||||
|
'single' => 'CodeIgniter\Validation\Views\single',
|
||||||
|
];
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// Rules
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\View as BaseView;
|
||||||
|
use CodeIgniter\View\ViewDecoratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @phpstan-type parser_callable (callable(mixed): mixed)
|
||||||
|
* @phpstan-type parser_callable_string (callable(mixed): mixed)&string
|
||||||
|
*/
|
||||||
|
class View extends BaseView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* When false, the view method will clear the data between each
|
||||||
|
* call. This keeps your data safe and ensures there is no accidental
|
||||||
|
* leaking between calls, so you would need to explicitly pass the data
|
||||||
|
* to each view. You might prefer to have the data stick around between
|
||||||
|
* calls so that it is available to all views. If that is the case,
|
||||||
|
* set $saveData to true.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $saveData = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parser Filters map a filter name with any PHP callable. When the
|
||||||
|
* Parser prepares a variable for display, it will chain it
|
||||||
|
* through the filters in the order defined, inserting any parameters.
|
||||||
|
* To prevent potential abuse, all filters MUST be defined here
|
||||||
|
* in order for them to be available for use within the Parser.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
* { title|esc(js) }
|
||||||
|
* { created_on|date(Y-m-d)|esc(attr) }
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
* @phpstan-var array<string, parser_callable_string>
|
||||||
|
*/
|
||||||
|
public $filters = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parser Plugins provide a way to extend the functionality provided
|
||||||
|
* by the core Parser by creating aliases that will be replaced with
|
||||||
|
* any callable. Can be single or tag pair.
|
||||||
|
*
|
||||||
|
* @var array<string, callable|list<string>|string>
|
||||||
|
* @phpstan-var array<string, list<parser_callable_string>|parser_callable_string|parser_callable>
|
||||||
|
*/
|
||||||
|
public $plugins = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View Decorators are class methods that will be run in sequence to
|
||||||
|
* have a chance to alter the generated output just prior to caching
|
||||||
|
* the results.
|
||||||
|
*
|
||||||
|
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
|
||||||
|
*
|
||||||
|
* @var list<class-string<ViewDecoratorInterface>>
|
||||||
|
*/
|
||||||
|
public array $decorators = [];
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Authentication;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Pelanggan;
|
||||||
|
|
||||||
|
class AuthController extends BaseController
|
||||||
|
{
|
||||||
|
protected $userModel;
|
||||||
|
protected $pelangganModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->userModel = new User();
|
||||||
|
$this->pelangganModel = new Pelanggan();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function login()
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$email = $this->request->getPost('email');
|
||||||
|
$password = $this->request->getPost('password');
|
||||||
|
|
||||||
|
if (!empty($email) && !empty($password)) {
|
||||||
|
$user = $this->userModel->where('email', $email)->first();
|
||||||
|
|
||||||
|
if ($user && password_verify($password, $user['password'])) {
|
||||||
|
$checkPelangganOrNot = $this->pelangganModel->where('user_id', $user['id'])->first();
|
||||||
|
session()->set([
|
||||||
|
'isLoggedIn' => true,
|
||||||
|
'userType' => $user['usertype'],
|
||||||
|
'name' => $user['name'],
|
||||||
|
'email' => $user['email'],
|
||||||
|
'id' => $user['id'],
|
||||||
|
'pelanggan' => $checkPelangganOrNot ? true : false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Berhasil login!',
|
||||||
|
'redirect' => $checkPelangganOrNot ? '/' : '/dashboard',
|
||||||
|
];
|
||||||
|
return $this->response->setJSON($response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setJSON(['status' => 'error', 'message' => 'Invalid email or password.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('auth/login');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$userData = [
|
||||||
|
'name' => $this->request->getPost('name'),
|
||||||
|
'email' => $this->request->getPost('email'),
|
||||||
|
'password' => password_hash($this->request->getPost('password'), PASSWORD_BCRYPT),
|
||||||
|
'usertype' => 'pelanggan',
|
||||||
|
];
|
||||||
|
|
||||||
|
$findEmail = $this->userModel->where('email', $userData['email'])->first();
|
||||||
|
if ($findEmail) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Email sudah terdaftar!'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->userModel->insert($userData)) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Berhasil daftar, silahkan login!',
|
||||||
|
'redirect' => '/login'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Gagal daftar!'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('auth/register');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout()
|
||||||
|
{
|
||||||
|
session()->destroy();
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => true,
|
||||||
|
'icon' => 'success',
|
||||||
|
'title' => 'Success!',
|
||||||
|
'text' => 'Logout berhasil.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
use CodeIgniter\HTTP\CLIRequest;
|
||||||
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class BaseController
|
||||||
|
*
|
||||||
|
* BaseController provides a convenient place for loading components
|
||||||
|
* and performing functions that are needed by all your controllers.
|
||||||
|
* Extend this class in any new controllers:
|
||||||
|
* class Home extends BaseController
|
||||||
|
*
|
||||||
|
* For security be sure to declare any new methods as protected or private.
|
||||||
|
*/
|
||||||
|
abstract class BaseController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Instance of the main Request object.
|
||||||
|
*
|
||||||
|
* @var CLIRequest|IncomingRequest
|
||||||
|
*/
|
||||||
|
protected $request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of helpers to be loaded automatically upon
|
||||||
|
* class instantiation. These helpers will be available
|
||||||
|
* to all other controllers that extend BaseController.
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
protected $helpers = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Be sure to declare properties for any property fetch you initialized.
|
||||||
|
* The creation of dynamic property is deprecated in PHP 8.2.
|
||||||
|
*/
|
||||||
|
// protected $session;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
// Do Not Edit This Line
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
|
||||||
|
// Preload any models, libraries, etc, here.
|
||||||
|
|
||||||
|
// E.g.: $this->session = \Config\Services::session();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Dashboard;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Jadwal;
|
||||||
|
use App\Models\Paket;
|
||||||
|
use App\Models\Pelanggan;
|
||||||
|
use App\Models\Transaksi;
|
||||||
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class DashboardController extends BaseController
|
||||||
|
{
|
||||||
|
protected $paketModel;
|
||||||
|
protected $pelangganModel;
|
||||||
|
protected $transaksiModel;
|
||||||
|
protected $userModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->userModel = new User();
|
||||||
|
$this->paketModel = new Paket();
|
||||||
|
$this->pelangganModel = new Pelanggan();
|
||||||
|
$this->transaksiModel = new Transaksi();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data = null;
|
||||||
|
|
||||||
|
if (session()->has('pelanggan')) {
|
||||||
|
$data = $this->pelangganModel->where('user_id', session()->get('id'))->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
$pemasangan = new Jadwal();
|
||||||
|
$transaksi = new Transaksi();
|
||||||
|
$currentMonth = Carbon::now()->month;
|
||||||
|
$currentYear = Carbon::now()->year;
|
||||||
|
|
||||||
|
// Fetch and format dataPemasangan
|
||||||
|
$dataPemasangan = $pemasangan->select("DATE(created_at) as day, COUNT(*) as count", false)
|
||||||
|
->where('type_jadwal', 'instalasi_baru')
|
||||||
|
->where('MONTH(created_at)', $currentMonth, false)
|
||||||
|
->where('YEAR(created_at)', $currentYear, false)
|
||||||
|
->groupBy('day')
|
||||||
|
->orderBy('day')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$dataPemasanganFormatted = array_map(function ($item) {
|
||||||
|
return ['label' => $item['day'], 'value' => $item['count']];
|
||||||
|
}, $dataPemasangan);
|
||||||
|
|
||||||
|
// Fetch and format dataTransaksi
|
||||||
|
$dataTransaksi = $transaksi->select("DATE(created_at) as day, COUNT(*) as count", false)
|
||||||
|
->where('MONTH(created_at)', $currentMonth, false)
|
||||||
|
->where('YEAR(created_at)', $currentYear, false)
|
||||||
|
->groupBy('day')
|
||||||
|
->orderBy('day')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$dataTransaksiFormatted = array_map(function ($item) {
|
||||||
|
return ['label' => $item['day'], 'value' => $item['count']];
|
||||||
|
}, $dataTransaksi);
|
||||||
|
|
||||||
|
return view('dashboard/index', [
|
||||||
|
'title' => 'Dashboard',
|
||||||
|
'paketCount' => $this->paketModel->countAll(),
|
||||||
|
'pelangganCount' => $this->pelangganModel->countAll(),
|
||||||
|
'transaksiCount' => $this->transaksiModel->countAll(),
|
||||||
|
'data' => $data,
|
||||||
|
'dataPemasangan' => $dataPemasanganFormatted,
|
||||||
|
'dataTransaksi' => $dataTransaksiFormatted,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function profile($id)
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'name' => $this->request->getPost('name'),
|
||||||
|
'email' => $this->request->getPost('email'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $this->userModel->update($id, $data);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('dashboard/profile/'.$id)->with('error', 'Gagal update profile');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->to('dashboard/profile/'.$id)->with('success', 'Berhasil update profile');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/profile', [
|
||||||
|
//dd([
|
||||||
|
'title' => 'Update Profile',
|
||||||
|
'data' => $this->userModel->where('id', $id)->first(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function password($id)
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$old_password = $this->request->getPost('old_password');
|
||||||
|
$new_password = $this->request->getPost('new_password');
|
||||||
|
$confirm_new_password = $this->request->getPost('confirm_new_password');
|
||||||
|
|
||||||
|
if ($new_password === $confirm_new_password) {
|
||||||
|
return redirect()->to('dashboard/profile')->with('error', 'Password tidak sama!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = $this->userModel->where('id', $id)->first();
|
||||||
|
$isPasswordMatch = password_verify($old_password, $user['password']);
|
||||||
|
|
||||||
|
if (!$isPasswordMatch) {
|
||||||
|
return redirect()->to('dashboard/profile/'.$id)->with('error', 'Password salah!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$update = $this->userModel->update($id,['password' => password_hash($new_password, PASSWORD_BCRYPT)]);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('dashboard/profile/'.$id)->with('error', 'Gagal update password');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->to('dashboard/profile/'.$id)->with('success', 'Berhasil update password');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,213 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Dashboard;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Jadwal;
|
||||||
|
use App\Models\Transaksi;
|
||||||
|
use App\Models\Pelanggan;
|
||||||
|
use App\Models\Ticket;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class JadwalController extends BaseController
|
||||||
|
{
|
||||||
|
protected $jadwalModel;
|
||||||
|
protected $transaksiModel;
|
||||||
|
protected $pelangganModel;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->jadwalModel = new Jadwal();
|
||||||
|
$this->transaksiModel = new Transaksi();
|
||||||
|
$this->pelangganModel = new Pelanggan();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (session()->userType === 'teknisi') {
|
||||||
|
$data = $this->jadwalModel
|
||||||
|
->select('jadwal.*, users.name as name, pelanggan.geolocation as geolocation, pelanggan.alamat as alamat')
|
||||||
|
->join('pelanggan', 'pelanggan.id = jadwal.pelanggan_id')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->where('jadwal.teknisi_id', session()->id)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
} else {
|
||||||
|
$data = $this->jadwalModel
|
||||||
|
->select('jadwal.*, users.name as name, pelanggan.geolocation as geolocation, pelanggan.alamat as alamat')
|
||||||
|
->join('pelanggan', 'pelanggan.id = jadwal.pelanggan_id')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/jadwal/index', [
|
||||||
|
//dd([
|
||||||
|
'title' => 'Jadwal',
|
||||||
|
'data' => $data
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'GET') {
|
||||||
|
return view('dashboard/rekap/jadwal/create', [
|
||||||
|
'title' => 'Tambah Jadwal',
|
||||||
|
'transaksi' => $this->transaksiModel->findAll(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'pelanggan_id' => $this->request->getPost('pelanggan_id'),
|
||||||
|
'bukti_kegiatan' => $this->request->getPost('bukti_kegiatan'),
|
||||||
|
'type_jadwal' => $this->request->getPost('type_jadwal'),
|
||||||
|
'status' => '0',
|
||||||
|
];
|
||||||
|
|
||||||
|
$create = $this->jadwalModel->insert($data);
|
||||||
|
|
||||||
|
if (!$create) {
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('error', 'Gagal tambah jadwal');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('success', 'Berhasil tambah jadwal');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($id)
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [];
|
||||||
|
$bukti_kegiatan = $this->request->getFile('bukti_kegiatan');
|
||||||
|
if ($bukti_kegiatan && $bukti_kegiatan->isValid() && !$bukti_kegiatan->hasMoved()) {
|
||||||
|
$extension = $bukti_kegiatan->getExtension();
|
||||||
|
$allowedExtensions = ['jpg', 'jpeg'];
|
||||||
|
|
||||||
|
if (in_array($extension, $allowedExtensions)) {
|
||||||
|
$newName = $bukti_kegiatan->getRandomName();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$bukti_kegiatan->move('uploads', $newName);
|
||||||
|
$data['bukti_kegiatan'] = $newName;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('error', 'Failed to upload bukti kegiatan.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('error', 'Only JPG and JPEG files are allowed for bukti kegiatan.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$foto_pelanggan = $this->request->getFile('foto_pelanggan');
|
||||||
|
if ($foto_pelanggan && $foto_pelanggan->isValid() && !$foto_pelanggan->hasMoved()) {
|
||||||
|
$extension = $foto_pelanggan->getExtension();
|
||||||
|
$allowedExtensions = ['jpg', 'jpeg'];
|
||||||
|
|
||||||
|
if (in_array($extension, $allowedExtensions)) {
|
||||||
|
$newName = $foto_pelanggan->getRandomName();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$foto_pelanggan->move('uploads', $newName);
|
||||||
|
$data['foto_pelanggan'] = $newName;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('error', 'Failed to upload foto pelanggan.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('error', 'Only JPG and JPEG files are allowed for foto pelanggan.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost('waktu_pemasangan')) {
|
||||||
|
$data['waktu_pemasangan'] = $this->request->getPost('waktu_pemasangan');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost('status')) {
|
||||||
|
$data['status'] = $this->request->getPost('status');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost('teknisi_id')) {
|
||||||
|
$data['teknisi_id'] = $this->request->getPost('teknisi_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($data)) {
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('error', 'No data to update.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$jadwal = new Jadwal();
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$pelanggan = new Pelanggan();
|
||||||
|
|
||||||
|
if ($this->request->getPost('status')) {
|
||||||
|
$findJadwal = $jadwal->where('id', $id)->where('type_jadwal', 'instalasi_baru')->first();
|
||||||
|
|
||||||
|
if ($findJadwal) {
|
||||||
|
$findPelanggan = $pelanggan->where('id', $findJadwal['pelanggan_id'])->first();
|
||||||
|
if ($findPelanggan && $findPelanggan['status'] === '0') {
|
||||||
|
$pelanggan->update($findPelanggan['id'], ['status' => $this->request->getPost('status')]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$getJadwal = $jadwal->find($id);
|
||||||
|
if (!$getJadwal) {
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('error', 'Jadwal not found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$update = $this->jadwalModel->update($id, $data);
|
||||||
|
if ($getJadwal['type_jadwal'] === 'perbaikan') {
|
||||||
|
$getTicket = $ticket->where('id', $getJadwal['ticket_id'])->first();
|
||||||
|
if ($getTicket) {
|
||||||
|
$ticket->update($getTicket['id'], ['status' => '1']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('error', 'Failed to update schedule.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('success', 'Schedule updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$jadwalModel = new Jadwal();
|
||||||
|
$userModel = new User();
|
||||||
|
|
||||||
|
$jadwalData = $jadwalModel->find($id);
|
||||||
|
|
||||||
|
// Get the chosen waktu_pemasangan
|
||||||
|
$waktuPemasangan = $this->request->getVar('waktu_pemasangan');
|
||||||
|
|
||||||
|
// Get all technicians from the user table
|
||||||
|
$allTechnicians = $userModel->where('usertype', 'teknisi')->findAll();
|
||||||
|
|
||||||
|
if ($waktuPemasangan) {
|
||||||
|
// Get all technician IDs scheduled for the chosen waktu_pemasangan
|
||||||
|
$scheduledTechnicians = $jadwalModel->where('waktu_pemasangan', $waktuPemasangan)->findAll();
|
||||||
|
$scheduledTechnicianIds = array_column($scheduledTechnicians, 'teknisi_id');
|
||||||
|
|
||||||
|
// Filter out technicians who are not scheduled for the chosen waktu_pemasangan
|
||||||
|
$availableTechnicians = array_filter($allTechnicians, function ($technician) use ($scheduledTechnicianIds) {
|
||||||
|
return !in_array($technician['id'], $scheduledTechnicianIds);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// If no waktu_pemasangan is chosen, all technicians are available
|
||||||
|
$availableTechnicians = $allTechnicians;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->isAJAX()) {
|
||||||
|
return $this->response->setJSON(['teknisi' => array_values($availableTechnicians)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/jadwal/update', [
|
||||||
|
'title' => 'Jadwal',
|
||||||
|
'data' => $jadwalData,
|
||||||
|
'teknisi' => $availableTechnicians
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
$delete = $this->jadwalModel->delete($id);
|
||||||
|
|
||||||
|
if (!$delete) {
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('error', 'Gagal delete jadwal');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/jadwal')->with('success', 'Berhasil delete jadwal');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,301 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Dashboard;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Laporan;
|
||||||
|
use App\Models\Transaksi;
|
||||||
|
use App\Models\Jadwal;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
|
class LaporanController extends BaseController
|
||||||
|
{
|
||||||
|
protected $laporanModel;
|
||||||
|
protected $transaksiModel;
|
||||||
|
protected $jadwalModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->laporanModel = new Laporan();
|
||||||
|
$this->transaksiModel = new Transaksi();
|
||||||
|
$this->jadwalModel = new Jadwal();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('dashboard/rekap/transaksi/index', [
|
||||||
|
'title' => 'Rekap Transaksi',
|
||||||
|
'data' => $this->laporanModel
|
||||||
|
->select('
|
||||||
|
laporan.*,
|
||||||
|
users.name as name
|
||||||
|
')
|
||||||
|
->join('users', 'users.id = laporan.author')
|
||||||
|
->where('kategori', 'transaksi')
|
||||||
|
->findAll(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'author' => session()->get('id') ?? '1',
|
||||||
|
'start_date' => $this->request->getPost('start_date'),
|
||||||
|
'end_date' => $this->request->getPost('end_date'),
|
||||||
|
'kategori' => 'transaksi',
|
||||||
|
];
|
||||||
|
|
||||||
|
$create = $this->laporanModel->insert($data);
|
||||||
|
|
||||||
|
if (!$create) {
|
||||||
|
return redirect()->to('dashboard/rekap/transaksi')->with('error', 'Gagal membuat laporan');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/rekap/transaksi')->with('success', 'Berhasil membuat laporan');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/rekap/transaksi/create', [
|
||||||
|
'title' => 'Rekap Transaksi',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($id)
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'author' => session()->get('id'),
|
||||||
|
'start_date' => $this->request->getPost('start_date'),
|
||||||
|
'end_date' => $this->request->getPost('end_date'),
|
||||||
|
'kategori' => 'transaksi',
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $this->laporanModel->update($id, $data);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('dashboard/rekap/transaksi')->with('error', 'Gagal update laporan');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/rekap/transaksi')->with('success', 'Berhasil update laporan');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/rekap/transaksi/update', [
|
||||||
|
'title' => 'Rekap Transaksi',
|
||||||
|
'data' => $this->laporanModel->where('id', $id)->first(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
$delete = $this->laporanModel->delete($id);
|
||||||
|
|
||||||
|
if (!$delete) {
|
||||||
|
return redirect()->to('dashboard/rekap/transaksi')->with('error', 'Gagal delete laporan');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/rekap/transaksi')->with('success', 'Berhasil delete laporan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function export($id)
|
||||||
|
{
|
||||||
|
$date = $this->laporanModel->find($id);
|
||||||
|
|
||||||
|
$startDate = $date['start_date'] . ' 00:00:00';
|
||||||
|
$endDate = $date['end_date'] . ' 23:59:59';
|
||||||
|
|
||||||
|
$data = $this->transaksiModel
|
||||||
|
->select('
|
||||||
|
transaksi.*,
|
||||||
|
pelanggan.alamat as alamat,
|
||||||
|
pelanggan.nomor_whatsapp as nomor,
|
||||||
|
users.name as nama_pelanggan,
|
||||||
|
users.email as email_pelanggan,
|
||||||
|
')
|
||||||
|
->join('pelanggan', 'pelanggan.id = transaksi.pelanggan_id')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->where('transaksi.created_at >=', $startDate)
|
||||||
|
->where('transaksi.created_at <=', $endDate)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
|
||||||
|
$spreadsheet->getActiveSheet()->mergeCells('A1:I1');
|
||||||
|
$spreadsheet->getActiveSheet()->getStyle('A1')
|
||||||
|
->getAlignment()
|
||||||
|
->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||||
|
$spreadsheet->setActiveSheetIndex(0)
|
||||||
|
->setCellValue('A1', 'Laporan Transaksi')
|
||||||
|
->setCellValue('A2', 'Nama Pelanggan')
|
||||||
|
->setCellValue('B2', 'Email Pelanggan')
|
||||||
|
->setCellValue('C2', 'Alamat')
|
||||||
|
->setCellValue('D2', 'Nomor WhatsApp')
|
||||||
|
->setCellValue('E2', 'Total')
|
||||||
|
->setCellValue('F2', 'Keterangan')
|
||||||
|
->setCellValue('G2', 'Kategori Pembayaran')
|
||||||
|
->setCellValue('H2', 'Metode Pembayaran')
|
||||||
|
->setCellValue('I2', 'Tanggal');
|
||||||
|
$column = 3;
|
||||||
|
|
||||||
|
foreach ($data as $data) {
|
||||||
|
$status = $data['status'] === '1' ? 'Berhasil' : 'Diproses';
|
||||||
|
$kategori = $data['kategori_pembayaran'] === 'pasang_baru' ? 'Pasang Baru' : 'Bulanan';
|
||||||
|
$metode = $data['type_pembayaran'] === '1' ? 'Online' : 'Tunai/Cash';
|
||||||
|
$spreadsheet->setActiveSheetIndex(0)
|
||||||
|
->setCellValue('A' . $column, $data['nama_pelanggan'])
|
||||||
|
->setCellValue('B' . $column, $data['email_pelanggan'])
|
||||||
|
->setCellValue('C' . $column, $data['alamat'])
|
||||||
|
->setCellValue('D' . $column, $data['nomor'])
|
||||||
|
->setCellValue('E' . $column, $data['total'])
|
||||||
|
->setCellValue('F' . $column, $status)
|
||||||
|
->setCellValue('G' . $column, $kategori)
|
||||||
|
->setCellValue('H' . $column, $metode)
|
||||||
|
->setCellValue('I' . $column, $data['created_at']);
|
||||||
|
$column++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$fileName = 'Laporan Transaksi_' . $date['start_date'] . '_-_' . $date['end_date'];
|
||||||
|
|
||||||
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
header('Content-Disposition: attachment;filename=' . $fileName . '.xlsx');
|
||||||
|
header('Cache-Control: max-age=0');
|
||||||
|
|
||||||
|
$writer->save('php://output');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function indexJadwal()
|
||||||
|
{
|
||||||
|
return view('dashboard/rekap/jadwal/index', [
|
||||||
|
'title' => 'Rekap Jadwal',
|
||||||
|
'data' => $this->laporanModel
|
||||||
|
->select('
|
||||||
|
laporan.*,
|
||||||
|
users.name as name
|
||||||
|
')
|
||||||
|
->join('users', 'users.id = laporan.author')
|
||||||
|
->where('kategori', 'jadwal')
|
||||||
|
->findAll(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createJadwal()
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'author' => session()->get('id') ?? '1',
|
||||||
|
'start_date' => $this->request->getPost('start_date'),
|
||||||
|
'end_date' => $this->request->getPost('end_date'),
|
||||||
|
'kategori' => 'jadwal',
|
||||||
|
];
|
||||||
|
|
||||||
|
$create = $this->laporanModel->insert($data);
|
||||||
|
|
||||||
|
if (!$create) {
|
||||||
|
return redirect()->to('dashboard/rekap/jadwal')->with('error', 'Gagal membuat laporan');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/rekap/jadwal')->with('success', 'Berhasil membuat laporan');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/rekap/jadwal/create', [
|
||||||
|
'title' => 'Rekap Jadwal',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateJadwal($id)
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'author' => session()->get('id'),
|
||||||
|
'start_date' => $this->request->getPost('start_date'),
|
||||||
|
'end_date' => $this->request->getPost('end_date'),
|
||||||
|
'kategori' => 'jadwal',
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $this->laporanModel->update($id, $data);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('dashboard/rekap/jadwal')->with('error', 'Gagal update laporan');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/rekap/jadwal')->with('success', 'Berhasil update laporan');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/rekap/jadwal/update', [
|
||||||
|
'title' => 'Rekap Jadwal',
|
||||||
|
'data' => $this->laporanModel->where('id', $id)->first(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteJadwal($id)
|
||||||
|
{
|
||||||
|
$delete = $this->laporanModel->delete($id);
|
||||||
|
|
||||||
|
if (!$delete) {
|
||||||
|
return redirect()->to('dashboard/rekap/jadwal')->with('error', 'Gagal delete laporan');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/rekap/jadwal')->with('success', 'Berhasil delete laporan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportJadwal($id)
|
||||||
|
{
|
||||||
|
$date = $this->laporanModel->find($id);
|
||||||
|
|
||||||
|
$startDate = $date['start_date'] . ' 00:00:00';
|
||||||
|
$endDate = $date['end_date'] . ' 23:59:59';
|
||||||
|
|
||||||
|
$data = $this->jadwalModel
|
||||||
|
->select('
|
||||||
|
jadwal.*,
|
||||||
|
pelanggan.geolocation as geolocation,
|
||||||
|
pelanggan.alamat as alamat,
|
||||||
|
user_pelanggan.name as nama_pelanggan,
|
||||||
|
user_teknisi.name as nama_teknisi
|
||||||
|
')
|
||||||
|
->join('pelanggan', 'jadwal.pelanggan_id = pelanggan.id')
|
||||||
|
->join('users as user_pelanggan', 'pelanggan.user_id = user_pelanggan.id')
|
||||||
|
->join('users as user_teknisi', 'jadwal.teknisi_id = user_teknisi.id')
|
||||||
|
->where('jadwal.created_at >=', $startDate)
|
||||||
|
->where('jadwal.created_at <=', $endDate)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
|
||||||
|
$spreadsheet->getActiveSheet()->getStyle('D')->getNumberFormat()
|
||||||
|
->setFormatCode('#,##0.00');
|
||||||
|
$spreadsheet->getActiveSheet()->mergeCells('A1:G1');
|
||||||
|
$spreadsheet->getActiveSheet()->getStyle('A1')
|
||||||
|
->getAlignment()
|
||||||
|
->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||||
|
$spreadsheet->setActiveSheetIndex(0)
|
||||||
|
->setCellValue('A1', 'Laporan Jadwal')
|
||||||
|
->setCellValue('A2', 'Nama Pelanggan')
|
||||||
|
->setCellValue('B2', 'Nama Teknisi')
|
||||||
|
->setCellValue('C2', 'ID Tiket Laporan')
|
||||||
|
->setCellValue('D2', 'Waktu Pemasangan')
|
||||||
|
->setCellValue('E2', 'Geolocation')
|
||||||
|
->setCellValue('F2', 'Alamat')
|
||||||
|
->setCellValue('G2', 'Tipe Jadwal');
|
||||||
|
$column = 3;
|
||||||
|
|
||||||
|
foreach ($data as $data) {
|
||||||
|
$status = $data['status'] === '1' ? 'Berhasil' : 'Diproses';
|
||||||
|
$spreadsheet->setActiveSheetIndex(0)
|
||||||
|
->setCellValue('A' . $column, $data['nama_pelanggan'])
|
||||||
|
->setCellValue('B' . $column, $data['nama_teknisi'])
|
||||||
|
->setCellValue('C' . $column, $data['ticket_id'])
|
||||||
|
->setCellValue('D' . $column, $data['waktu_pemasangan'])
|
||||||
|
->setCellValue('E' . $column, $data['geolocation'])
|
||||||
|
->setCellValue('F' . $column, $data['alamat'])
|
||||||
|
->setCellValue('G' . $column, $status);
|
||||||
|
$column++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$fileName = 'Laporan Transaksi_' . $date['start_date'] . '_-_' . $date['end_date'];
|
||||||
|
|
||||||
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
header('Content-Disposition: attachment;filename=' . $fileName . '.xlsx');
|
||||||
|
header('Cache-Control: max-age=0');
|
||||||
|
|
||||||
|
$writer->save('php://output');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Dashboard;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Paket;
|
||||||
|
|
||||||
|
class PaketController extends BaseController
|
||||||
|
{
|
||||||
|
protected $paketModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->paketModel = new Paket();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('dashboard/paket/index', [
|
||||||
|
'title' => 'Paket',
|
||||||
|
'data' => $this->paketModel->findAll(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'nama' => $this->request->getPost('nama'),
|
||||||
|
'kecepatan' => $this->request->getPost('kecepatan'),
|
||||||
|
'harga' => $this->request->getPost('harga'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$create = $this->paketModel->insert($data);
|
||||||
|
|
||||||
|
if(!$create) {
|
||||||
|
return redirect()->to('dashboard/paket')->with('error', 'Gagal update paket');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/paket')->with('success', 'Berhasil update paket');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/paket/create', [
|
||||||
|
'title' => 'Paket',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($id)
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'nama' => $this->request->getPost('nama'),
|
||||||
|
'kecepatan' => $this->request->getPost('kecepatan'),
|
||||||
|
'harga' => $this->request->getPost('harga'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $this->paketModel->update($id, $data);
|
||||||
|
|
||||||
|
if(!$update) {
|
||||||
|
return redirect()->to('dashboard/paket')->with('error', 'Gagal update paket');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/paket')->with('success', 'Berhasil update paket');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/paket/update', [
|
||||||
|
'title' => 'Paket',
|
||||||
|
'data' => $this->paketModel->where('id', $id)->first()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
$delete = $this->paketModel->delete($id);
|
||||||
|
|
||||||
|
if(!$delete) {
|
||||||
|
return redirect()->to('dashboard/paket')->with('error', 'Gagal delete paket');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/paket')->with('success', 'Berhasil delete paket');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,193 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Dashboard;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Pelanggan;
|
||||||
|
use App\Models\Transaksi;
|
||||||
|
use App\Models\Paket;
|
||||||
|
use App\Models\Jadwal;
|
||||||
|
|
||||||
|
class PelangganController extends BaseController
|
||||||
|
{
|
||||||
|
protected $transaksiModel;
|
||||||
|
protected $pelangganModel;
|
||||||
|
protected $paketModel;
|
||||||
|
protected $jadwalModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->transaksiModel = new Transaksi();
|
||||||
|
$this->pelangganModel = new Pelanggan();
|
||||||
|
$this->paketModel = new Paket();
|
||||||
|
$this->jadwalModel = new Jadwal();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createTagihanBulanan($id)
|
||||||
|
{
|
||||||
|
$pelanggan = $this->pelangganModel->find($id);
|
||||||
|
$transaksi = $this->transaksiModel
|
||||||
|
->where('pelanggan_id', $id)
|
||||||
|
->where('kategori_pembayaran', 'bulanan')
|
||||||
|
->where('status', '0')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($transaksi) {
|
||||||
|
return redirect()->to('dashboard/pelanggan')->with('error', 'Gagal tambah tagihan, pelanggan sudah ada tagihan bulanan');
|
||||||
|
}
|
||||||
|
|
||||||
|
$paket = $this->paketModel->find($pelanggan['paket']);
|
||||||
|
$data = [
|
||||||
|
'pelanggan_id' => $pelanggan['id'],
|
||||||
|
'total' => $paket['harga'] + 2000,
|
||||||
|
'status' => '0',
|
||||||
|
'kategori_pembayaran' => 'bulanan',
|
||||||
|
'type_pembayaran' => '1',
|
||||||
|
];
|
||||||
|
|
||||||
|
$create = $this->transaksiModel->insert($data);
|
||||||
|
|
||||||
|
|
||||||
|
if (!$create) {
|
||||||
|
return redirect()->to('dashboard/pelanggan')->with('error', 'Gagal tambah tagihan');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/pelanggan')->with('success', 'Berhasil tambah tagihan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('dashboard/pelanggan/index', [
|
||||||
|
//dd([
|
||||||
|
'title' => 'Pelanggan',
|
||||||
|
'data' => $this->pelangganModel
|
||||||
|
->select('
|
||||||
|
pelanggan.*,
|
||||||
|
users.name as nama,
|
||||||
|
users.email as email,
|
||||||
|
paket.nama as nama_paket,
|
||||||
|
paket.kecepatan as kecepatan_paket
|
||||||
|
')
|
||||||
|
->join('paket', 'pelanggan.paket = paket.id')
|
||||||
|
->join('users', 'pelanggan.user_id = users.id')
|
||||||
|
->get()
|
||||||
|
->getResultArray()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($id)
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'user_id' => $this->request->getPost('user_id'),
|
||||||
|
'nomor_whatsapp' => $this->request->getPost('nomor_whatsapp'),
|
||||||
|
'geolocation' => $this->request->getPost('geolocation'),
|
||||||
|
'alamat' => $this->request->getPost('alamat'),
|
||||||
|
'paket' => $this->request->getPost('paket'),
|
||||||
|
'foto_diri' => $this->request->getPost('foto_diri'),
|
||||||
|
'status' => $this->request->getPost('status'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $this->pelangganModel->update($id, $data);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('dashboard/pelanggan')->with('error', 'Gagal update pelanggan');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/pelanggan')->with('success', 'Berhasil update pelanggan');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/pelanggan/update', [
|
||||||
|
//dd([
|
||||||
|
'title' => 'Pelanggan',
|
||||||
|
'data' => $this->pelangganModel->where('id', $id)->first()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function lengkapiInformasi($id)
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$validation = \Config\Services::validation();
|
||||||
|
$validation->setRules([
|
||||||
|
'nomor_whatsapp' => 'required|regex_match[/^08[1-9][0-9]{8,12}$/]',
|
||||||
|
'geolocation' => 'required',
|
||||||
|
'paket' => 'required',
|
||||||
|
'foto_diri' => 'uploaded[foto_diri]|max_size[foto_diri,1024]|is_image[foto_diri]|mime_in[foto_diri,image/jpg,image/jpeg]',
|
||||||
|
'type_pembayaran' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$validation->withRequest($this->request)->run()) {
|
||||||
|
return redirect()->back()->withInput()->with('errors', $validation->getErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
$foto_diri = $this->request->getFile('foto_diri');
|
||||||
|
$newName = $foto_diri->getRandomName();
|
||||||
|
$foto_diri->move('uploads', $newName);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'user_id' => $id,
|
||||||
|
'nomor_whatsapp' => $this->request->getPost('nomor_whatsapp'),
|
||||||
|
'geolocation' => $this->request->getPost('geolocation'),
|
||||||
|
'alamat' => $this->request->getPost('alamat'),
|
||||||
|
'paket' => $this->request->getPost('paket'),
|
||||||
|
'foto_diri' => $newName,
|
||||||
|
'status' => '0',
|
||||||
|
];
|
||||||
|
|
||||||
|
$create = $this->pelangganModel->insert($data);
|
||||||
|
|
||||||
|
//dd($create);
|
||||||
|
if (!$create) {
|
||||||
|
return redirect()->back()->withInput()->with('error', 'Gagal melengkapi informasi');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost('type_pembayaran') === '1') {
|
||||||
|
$pelanggan = $this->pelangganModel->where('user_id', $id)->first();
|
||||||
|
$data_paket = $this->paketModel->find($data['paket']);
|
||||||
|
$data_transaksi = [
|
||||||
|
'pelanggan_id' => $pelanggan['id'],
|
||||||
|
'total' => $data_paket['harga'] + 2000,
|
||||||
|
'status' => '0',
|
||||||
|
'kategori_pembayaran' => 'pasang_baru',
|
||||||
|
'type_pembayaran' => $this->request->getPost('type_pembayaran'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$transaksi = $this->transaksiModel->insert($data_transaksi);
|
||||||
|
|
||||||
|
if (!$transaksi) {
|
||||||
|
return redirect()->back()->withInput()->with('error', 'Gagal membuat transaksi');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost('type_pembayaran') === '0') {
|
||||||
|
$pelanggan = $this->pelangganModel->where('user_id', $id)->first();
|
||||||
|
$data_paket = $this->paketModel->find($data['paket']);
|
||||||
|
$data_transaksi = [
|
||||||
|
'pelanggan_id' => $pelanggan['id'],
|
||||||
|
'total' => $data_paket['harga'] + 2000,
|
||||||
|
'status' => '0',
|
||||||
|
'kategori_pembayaran' => 'pasang_baru',
|
||||||
|
'type_pembayaran' => $this->request->getPost('type_pembayaran'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$data_jadwal = [
|
||||||
|
'pelanggan_id' => $pelanggan['id'],
|
||||||
|
'ticket_id' => null,
|
||||||
|
'waktu_pemasangan' => null,
|
||||||
|
'bukti_kegiatan' => null,
|
||||||
|
'type_jadwal' => 'instalasi_baru',
|
||||||
|
'status' => '0',
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->transaksiModel->insert($data_transaksi);
|
||||||
|
$this->jadwalModel->insert($data_jadwal);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Berhasil melengkapi informasi! Silahkan login kembali.');
|
||||||
|
session()->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('home/pelanggan/insertInformasi', [
|
||||||
|
'title' => 'Lengkapi Pendaftaran Internet Anda',
|
||||||
|
'paket' => $this->paketModel->findAll(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,330 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Dashboard;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Transaksi;
|
||||||
|
use App\Models\Pelanggan;
|
||||||
|
use App\Models\Jadwal;
|
||||||
|
use Midtrans\Config;
|
||||||
|
use Midtrans\Snap;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
use Dompdf\Dompdf;
|
||||||
|
use Dompdf\Options;
|
||||||
|
|
||||||
|
class TransaksiController extends BaseController
|
||||||
|
{
|
||||||
|
protected $transaksiModel;
|
||||||
|
protected $pelangganModel;
|
||||||
|
protected $jadwalModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->transaksiModel = new Transaksi();
|
||||||
|
$this->pelangganModel = new Pelanggan();
|
||||||
|
$this->jadwalModel = new Jadwal();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function export()
|
||||||
|
{
|
||||||
|
$startDate = $this->request->getPost('startDate');
|
||||||
|
$endDate = $this->request->getPost('endDate');
|
||||||
|
$format = $this->request->getPost('format');
|
||||||
|
|
||||||
|
if (empty($startDate) || empty($endDate)) {
|
||||||
|
return redirect()->back()->with('error', 'Please select both start and end dates.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaksiModel = new Transaksi();
|
||||||
|
$data = $transaksiModel->select('
|
||||||
|
transaksi.*,
|
||||||
|
pelanggan.id as id_pelanggan,
|
||||||
|
pelanggan.alamat as alamat,
|
||||||
|
users.name as name,
|
||||||
|
')
|
||||||
|
->join('pelanggan', 'pelanggan.id = transaksi.pelanggan_id')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->where('transaksi.created_at >=', $startDate)
|
||||||
|
->where('transaksi.created_at <=', $endDate)
|
||||||
|
->where('transaksi.status', '1')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
if ($format == 'pdf') {
|
||||||
|
$this->exportPdf($data);
|
||||||
|
} elseif ($format == 'excel') {
|
||||||
|
$this->exportExcel($data);
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Invalid export format.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function exportPdf($data)
|
||||||
|
{
|
||||||
|
$options = new Options();
|
||||||
|
$options->set('isHtml5ParserEnabled', true);
|
||||||
|
$options->set('isPhpEnabled', true);
|
||||||
|
$dompdf = new Dompdf($options);
|
||||||
|
|
||||||
|
$html = view('dashboard/transaksi/pdf_report', ['data' => $data]);
|
||||||
|
|
||||||
|
$dompdf->loadHtml($html);
|
||||||
|
|
||||||
|
$dompdf->render();
|
||||||
|
|
||||||
|
$dompdf->stream('laporan_transaksi.pdf', array('Attachment' => 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function exportExcel($data)
|
||||||
|
{
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
$sheet->setCellValue('A1', 'Nama Pelanggan');
|
||||||
|
$sheet->setCellValue('B1', 'Alamat');
|
||||||
|
$sheet->setCellValue('C1', 'Kategori Pembayaran');
|
||||||
|
$sheet->setCellValue('D1', 'Tipe Pembayaran');
|
||||||
|
$sheet->setCellValue('E1', 'Total');
|
||||||
|
$sheet->setCellValue('F1', 'Tanggal Pembayaran');
|
||||||
|
|
||||||
|
$sheet->getStyle('A1:F1')->getFont()->setBold(true);
|
||||||
|
|
||||||
|
$row = 2;
|
||||||
|
$totalAmount = 0;
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$sheet->setCellValue('A' . $row, $item['name']);
|
||||||
|
$sheet->setCellValue('B' . $row, $item['alamat']);
|
||||||
|
$sheet->setCellValue('C' . $row, $item['kategori_pembayaran']);
|
||||||
|
$sheet->setCellValue('D' . $row, $item['type_pembayaran'] === '1' ? 'Online' : 'COD');
|
||||||
|
$sheet->setCellValue('E' . $row, $item['total']);
|
||||||
|
$sheet->setCellValue('F' . $row, $item['updated_at']);
|
||||||
|
|
||||||
|
$totalAmount += $item['total'];
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sheet->setCellValue('D' . $row, 'Total');
|
||||||
|
$sheet->setCellValue('E' . $row, $totalAmount);
|
||||||
|
|
||||||
|
$sheet->getStyle('D' . $row . ':E' . $row)->getFont()->setBold(true);
|
||||||
|
|
||||||
|
foreach (range('A', 'F') as $columnID) {
|
||||||
|
$sheet->getColumnDimension($columnID)->setAutoSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = 'laporan_transaksi.xlsx';
|
||||||
|
|
||||||
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
header('Content-Disposition: attachment;filename="' . $filename . '"');
|
||||||
|
header('Cache-Control: max-age=0');
|
||||||
|
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save('php://output');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('dashboard/transaksi/index', [
|
||||||
|
'title' => 'Data Transaksi',
|
||||||
|
'data' => $this->transaksiModel->select('
|
||||||
|
transaksi.*,
|
||||||
|
pelanggan.id as id_pelanggan,
|
||||||
|
pelanggan.alamat as alamat,
|
||||||
|
users.name as name,
|
||||||
|
')
|
||||||
|
->join('pelanggan', 'pelanggan.id = transaksi.pelanggan_id')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->get()
|
||||||
|
->getResultArray(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function detail($id)
|
||||||
|
{
|
||||||
|
$responseSuccess = [
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Berhasil Validasi Pembayaran'
|
||||||
|
];
|
||||||
|
|
||||||
|
$reponseError = [
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Gagal Update Pembayaran'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
$transaksi = new Transaksi();
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'status' => '1',
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $transaksi->update($id, $data);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return $this->response->setJSON($reponseError, 200);
|
||||||
|
}
|
||||||
|
return $this->response->setJSON($responseSuccess, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/transaksi/detail', [
|
||||||
|
'title' => 'Detail Transaksi',
|
||||||
|
'data' => $transaksi->where('id', $id)->first(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function detailPelanggan($id)
|
||||||
|
{
|
||||||
|
return view('home/transaksi/detail', [
|
||||||
|
//dd([
|
||||||
|
'title' => 'Detail Transaksi',
|
||||||
|
'data' => $this->transaksiModel->select('
|
||||||
|
transaksi.*,
|
||||||
|
pelanggan.nomor_whatsapp as nomor,
|
||||||
|
pelanggan.id as id_pelanggan,
|
||||||
|
pelanggan.alamat as alamat,
|
||||||
|
users.name as name,
|
||||||
|
users.email as email,
|
||||||
|
')
|
||||||
|
->join('pelanggan', 'pelanggan.id = transaksi.pelanggan_id')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->where('transaksi.id', $id)
|
||||||
|
->first(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
$delete = $this->transaksiModel->delete($id);
|
||||||
|
|
||||||
|
if (!$delete) {
|
||||||
|
return redirect()->to('dashboard/transaksi')->with('message', 'Berhasil delete transaksi');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/transaksi')->with('message', 'Berhasil delete transaksi');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function transaksiSaya($id)
|
||||||
|
{
|
||||||
|
$id_pelanggan = $this->pelangganModel->where('user_id', $id)->first();
|
||||||
|
return view('home/transaksi/historyTransaksi', [
|
||||||
|
'title' => 'Transaksi Saya',
|
||||||
|
'data' => $this->transaksiModel->select('
|
||||||
|
transaksi.*,
|
||||||
|
pelanggan.nomor_whatsapp as nomor,
|
||||||
|
pelanggan.alamat as alamat,
|
||||||
|
users.name as name,
|
||||||
|
users.email as email,
|
||||||
|
')
|
||||||
|
->join('pelanggan', 'pelanggan.id = transaksi.pelanggan_id')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->where('transaksi.pelanggan_id', $id_pelanggan['id'])
|
||||||
|
->get()
|
||||||
|
->getResultArray(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bayarOnline($id)
|
||||||
|
{
|
||||||
|
$data = $this->transaksiModel->select('
|
||||||
|
transaksi.*,
|
||||||
|
pelanggan.nomor_whatsapp as nomor,
|
||||||
|
pelanggan.alamat as alamat,
|
||||||
|
paket.nama as nama_paket,
|
||||||
|
paket.kecepatan as kecepatan_paket,
|
||||||
|
users.name as name,
|
||||||
|
users.email as email,
|
||||||
|
')
|
||||||
|
->join('pelanggan', 'pelanggan.id = transaksi.pelanggan_id')
|
||||||
|
->join('paket', 'pelanggan.paket = paket.id')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->where('transaksi.id', $id)
|
||||||
|
->get()->getResultObject();
|
||||||
|
Config::$serverKey = env('MIDTRANS_SERVER_KEY');
|
||||||
|
Config::$isProduction = false;
|
||||||
|
Config::$isSanitized = true;
|
||||||
|
Config::$is3ds = true;
|
||||||
|
|
||||||
|
if (!is_numeric($data[0]->total)) {
|
||||||
|
return 'Invalid total amount. Please check transaction data.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$grossAmount = intval($data[0]->total);
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'transaction_details' => [
|
||||||
|
'order_id' => 'ORDER-' . time(),
|
||||||
|
'gross_amount' => $grossAmount,
|
||||||
|
],
|
||||||
|
'customer_details' => [
|
||||||
|
'first_name' => $data[0]->name,
|
||||||
|
'email' => $data[0]->email,
|
||||||
|
'phone' => $data[0]->nomor,
|
||||||
|
'billing_address' => [
|
||||||
|
'address' => $data[0]->alamat,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'item_details' => [
|
||||||
|
[
|
||||||
|
'id' => $data[0]->id,
|
||||||
|
'price' => $grossAmount,
|
||||||
|
'quantity' => 1,
|
||||||
|
'name' => $data[0]->nama_paket . '-' . $data[0]->kecepatan_paket
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'callbacks' => [
|
||||||
|
'finish' => 'http://localhost:8080/home/transaksi/saya/bayar/online'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$snapToken = json_encode(Snap::getSnapToken($params));
|
||||||
|
|
||||||
|
return $this->response->setJSON($snapToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateUniqueNumericId($model, $min = 100000, $max = 999999)
|
||||||
|
{
|
||||||
|
do {
|
||||||
|
$uniqueId = random_int($min, $max);
|
||||||
|
$exists = $model->where('pelanggan_id', $uniqueId)->first();
|
||||||
|
} while ($exists);
|
||||||
|
|
||||||
|
return $uniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatePaymentStatus()
|
||||||
|
{
|
||||||
|
$findPelanggan = $this->pelangganModel->where('user_id', session()->id)->first();
|
||||||
|
$transaksi = $this->transaksiModel
|
||||||
|
->where('status', '0')
|
||||||
|
->where('pelanggan_id', $findPelanggan['id'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($transaksi['kategori_pembayaran'] === 'bulanan') {
|
||||||
|
$this->transaksiModel->update($transaksi['id'], ['status' => '1']);
|
||||||
|
} else {
|
||||||
|
$id = $this->generateUniqueNumericId($this->pelangganModel);
|
||||||
|
|
||||||
|
$this->transaksiModel->update($transaksi['id'], [
|
||||||
|
'status' => '1',
|
||||||
|
'updated_at' => date('Y-m-d H:i:s')
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->pelangganModel->update($findPelanggan['id'], [
|
||||||
|
'pelanggan_id' => $id
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data_jadwal = [
|
||||||
|
'pelanggan_id' => $findPelanggan['id'],
|
||||||
|
'ticket_id' => null,
|
||||||
|
'waktu_pemasangan' => null,
|
||||||
|
'bukti_kegiatan' => null,
|
||||||
|
'foto_pelanggan' => null,
|
||||||
|
'type_jadwal' => 'instalasi_baru',
|
||||||
|
'status' => '0',
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->jadwalModel->insert($data_jadwal);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->to('home/transaksi/saya/detail/' . $transaksi['id'])->with('message', 'Pembayaran berhasil!');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,159 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers\Dashboard;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Pelanggan;
|
||||||
|
use App\Models\Transaksi;
|
||||||
|
use App\Models\Ticket;
|
||||||
|
use App\Models\Jadwal;
|
||||||
|
|
||||||
|
class UserController extends BaseController
|
||||||
|
{
|
||||||
|
protected $userModel;
|
||||||
|
protected $pelangganModel;
|
||||||
|
protected $transaksiModel;
|
||||||
|
protected $ticketModel;
|
||||||
|
protected $jadwalModel;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->userModel = new User();
|
||||||
|
$this->transaksiModel = new Transaksi();
|
||||||
|
$this->jadwalModel = new Jadwal();
|
||||||
|
$this->pelangganModel = new Pelanggan();
|
||||||
|
$this->ticketModel = new Ticket();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('dashboard/user/index', [
|
||||||
|
//dd([
|
||||||
|
'title' => 'User',
|
||||||
|
'data' => $this->userModel->where('id !=', session()->get('id'))->get()->getResultArray(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$password = $this->request->getPost('password');
|
||||||
|
$confirmPassword = $this->request->getPost('konfirmasi_password');
|
||||||
|
|
||||||
|
if ($password !== $confirmPassword) {
|
||||||
|
return redirect()->to('dashboard/user/create')->with('error', 'Password dan Konfirmasi Password tidak cocok');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'name' => $this->request->getPost('name'),
|
||||||
|
'email' => $this->request->getPost('email'),
|
||||||
|
'password' => password_hash($password, PASSWORD_BCRYPT),
|
||||||
|
'usertype' => $this->request->getPost('usertype'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$create = $this->userModel->insert($data);
|
||||||
|
|
||||||
|
if (!$create) {
|
||||||
|
return redirect()->to('dashboard/user')->with('error', 'Gagal tambah user');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/user')->with('success', 'Berhasil tambah user');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/user/create', [
|
||||||
|
'title' => 'User',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($id)
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'name' => $this->request->getPost('name'),
|
||||||
|
'email' => $this->request->getPost('email'),
|
||||||
|
'password' => password_hash(PASSWORD_BCRYPT, $this->request->getPost('password')),
|
||||||
|
'usertype' => $this->request->getPost('usertype'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $this->userModel->update($id, $data);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('dashboard/user')->with('error', 'Gagal update user');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/user')->with('success', 'Berhasil update user');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/user/update', [
|
||||||
|
'title' => 'User',
|
||||||
|
'data' => $this->userModel->where('id', $id)->first()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
$responseSuccess = [
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Berhasil Menghapus user'
|
||||||
|
];
|
||||||
|
|
||||||
|
$reponseError = [
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Gagal Menghapus user'
|
||||||
|
];
|
||||||
|
|
||||||
|
$user = $this->userModel->find($id);
|
||||||
|
if ($user && $user['usertype'] === 'admin') {
|
||||||
|
$delete = $this->userModel->delete($id);
|
||||||
|
if ($delete) {
|
||||||
|
return $this->response->setJSON($responseSuccess);
|
||||||
|
} else {
|
||||||
|
return $this->response->setJSON($reponseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user && $user['usertype'] === 'teknisi') {
|
||||||
|
$this->deleteInBatches($this->jadwalModel, 'teknisi_id', $id);
|
||||||
|
if ($this->userModel->delete($id)) {
|
||||||
|
return $this->response->setJSON($responseSuccess);
|
||||||
|
} else {
|
||||||
|
return $this->response->setJSON($reponseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user && $user['usertype'] === 'pelanggan') {
|
||||||
|
$findPelanggan = $this->pelangganModel->where('user_id', $id)->first();
|
||||||
|
if ($findPelanggan) {
|
||||||
|
$this->deleteInBatches($this->jadwalModel, 'pelanggan_id', $findPelanggan['id']);
|
||||||
|
$this->deleteInBatches($this->ticketModel, 'id_pelanggan', $findPelanggan['id']);
|
||||||
|
$this->deleteInBatches($this->transaksiModel, 'pelanggan_id', $findPelanggan['id']);
|
||||||
|
$this->pelangganModel->delete($findPelanggan['id']);
|
||||||
|
|
||||||
|
if ($this->userModel->delete($id)) {
|
||||||
|
return $this->response->setJSON($responseSuccess);
|
||||||
|
} else {
|
||||||
|
return $this->response->setJSON($reponseError);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($this->userModel->delete($id)) {
|
||||||
|
return $this->response->setJSON($responseSuccess);
|
||||||
|
} else {
|
||||||
|
return $this->response->setJSON($reponseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteInBatches($model, $column, $value, $batchSize = 1000)
|
||||||
|
{
|
||||||
|
do {
|
||||||
|
$records = $model->where($column, $value)->limit($batchSize)->findAll();
|
||||||
|
if (!empty($records)) {
|
||||||
|
$ids = [];
|
||||||
|
foreach ($records as $record) {
|
||||||
|
$ids[] = $record['id'];
|
||||||
|
}
|
||||||
|
$model->delete($ids);
|
||||||
|
}
|
||||||
|
} while (!empty($records));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Jadwal;
|
||||||
|
use App\Models\Paket;
|
||||||
|
use App\Models\Pelanggan;
|
||||||
|
use App\Models\User;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|
||||||
|
class Home extends BaseController
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('home/home', [
|
||||||
|
'title' => 'Home',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function paket()
|
||||||
|
{
|
||||||
|
$data = new Paket();
|
||||||
|
return view('home/paket', [
|
||||||
|
'title' => 'Paket',
|
||||||
|
'data' => $data->findAll()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function informasi()
|
||||||
|
{
|
||||||
|
return view('home/informasi', [
|
||||||
|
'title' => 'Informasi'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function profile($id)
|
||||||
|
{
|
||||||
|
$model = new User();
|
||||||
|
$pelanggan = new Pelanggan();
|
||||||
|
$jadwal = new Jadwal();
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'name' => $this->request->getPost('name'),
|
||||||
|
'email' => $this->request->getPost('email'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $model->update($id, $data);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('home/profile/'.$id)->with('error', 'Gagal update profile');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->to('home/profile/'.$id)->with('success', 'Berhasil update profile');
|
||||||
|
}
|
||||||
|
|
||||||
|
$findPelanggan = $pelanggan->where('user_id', session()->id)->first();
|
||||||
|
$findJadwal = $jadwal->where('pelanggan_id', $findPelanggan['id'])->where('type_jadwal', 'instalasi_baru')->first();
|
||||||
|
return view('home/profile', [
|
||||||
|
//dd([
|
||||||
|
'title' => 'Profile',
|
||||||
|
'data' => $model->where('id', $id)->first(),
|
||||||
|
'pemasangan' => $findPelanggan,
|
||||||
|
'jadwal' => $findJadwal,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function password($id)
|
||||||
|
{
|
||||||
|
$model = new User();
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$old_password = $this->request->getPost('old_password');
|
||||||
|
$new_password = $this->request->getPost('new_password');
|
||||||
|
$confirm_new_password = $this->request->getPost('confirm_new_password');
|
||||||
|
|
||||||
|
if ($new_password === $confirm_new_password) {
|
||||||
|
return redirect()->to('home/profile')->with('error', 'Password tidak sama!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = $model->where('id', $id)->first();
|
||||||
|
$isPasswordMatch = password_verify($old_password[0], $user['password']);
|
||||||
|
|
||||||
|
if (!$isPasswordMatch) {
|
||||||
|
return redirect()->to('home/profile/'.$id)->with('error', 'Password salah!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$update = $model->update($id,['password' => password_hash($new_password[0], PASSWORD_DEFAULT)]);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('home/profile/'.$id)->with('error', 'Gagal update password');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->to('home/profile/'.$id)->with('success', 'Berhasil update password');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,189 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Controllers\BaseController;
|
||||||
|
use App\Models\Pelanggan;
|
||||||
|
use App\Models\Ticket;
|
||||||
|
use App\Models\Jadwal;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|
||||||
|
class TicketController extends BaseController
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$pelanggan = new Pelanggan();
|
||||||
|
|
||||||
|
$findPelanggan = $pelanggan->where('user_id', session()->id)->first();
|
||||||
|
|
||||||
|
return view('home/lapor/index', [
|
||||||
|
'title' => 'Data Laporan Saya',
|
||||||
|
'data' => $ticket->where('id_pelanggan', $findPelanggan['id'])->findAll(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$pelanggan = new Pelanggan();
|
||||||
|
|
||||||
|
$findPelanggan = $pelanggan->where('user_id', session()->id)->first();
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'id_pelanggan' => $findPelanggan['id'],
|
||||||
|
'keluhan' => $this->request->getPost('keluhan'),
|
||||||
|
'status' => '0'
|
||||||
|
];
|
||||||
|
|
||||||
|
$create = $ticket->insert($data);
|
||||||
|
|
||||||
|
if (!$create) {
|
||||||
|
return redirect()->to('home/laporan/saya/' . session()->id)->with('error', 'Failed to create ticket.');
|
||||||
|
}
|
||||||
|
return redirect()->to('home/laporan/saya/' . session()->id)->with('success', 'Ticket created successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('home/lapor/create', [
|
||||||
|
'title' => 'Buat Laporan',
|
||||||
|
'data' => null
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($id)
|
||||||
|
{
|
||||||
|
$ticket = new Ticket();
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'keluhan' => $this->request->getPost('keluhan'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $ticket->update($id, $data);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('home/laporan/saya/' . session()->id)->with('error', 'Gagal update paket');
|
||||||
|
}
|
||||||
|
return redirect()->to('home/laporan/saya/' . session()->id)->with('success', 'Berhasil update paket');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('home/lapor/update', [
|
||||||
|
'title' => 'Update Laporan',
|
||||||
|
'data' => $ticket->find($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$delete = $ticket->delete($id);
|
||||||
|
|
||||||
|
if (session()->userType === 'admin') {
|
||||||
|
if (!$delete) {
|
||||||
|
return redirect()->to('dashboard/laporan')->with('error', 'Gagal delete paket');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/laporan')->with('success', 'Berhasil delete paket');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$delete) {
|
||||||
|
return redirect()->to('home/laporan/saya/' . session()->id)->with('error', 'Gagal delete paket');
|
||||||
|
}
|
||||||
|
return redirect()->to('home/laporan/saya/' . session()->id)->with('success', 'Berhasil delete paket');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function indexAdmin()
|
||||||
|
{
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$jadwal = new Jadwal();
|
||||||
|
|
||||||
|
// Retrieve all tickets
|
||||||
|
$tickets = $ticket
|
||||||
|
->select('
|
||||||
|
ticket.*,
|
||||||
|
pelanggan.nomor_whatsapp as nomor,
|
||||||
|
pelanggan.foto_diri as foto_pelanggan,
|
||||||
|
users.name as nama
|
||||||
|
')
|
||||||
|
->join('pelanggan', 'pelanggan.id = ticket.id_pelanggan')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
// Retrieve all schedules with associated ticket data
|
||||||
|
$schedulesWithTickets = $jadwal
|
||||||
|
->select('jadwal.*, users.name as name, pelanggan.geolocation as geolocation, pelanggan.alamat as alamat, ticket.id as id_ticket')
|
||||||
|
->join('pelanggan', 'pelanggan.id = jadwal.pelanggan_id')
|
||||||
|
->join('users', 'users.id = pelanggan.user_id')
|
||||||
|
->join('ticket', 'ticket.id = jadwal.ticket_id')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
return view('dashboard/lapor/index', [
|
||||||
|
//dd([
|
||||||
|
'title' => 'Data Laporan Pelanggan',
|
||||||
|
'data' => $tickets, // Pass ticket data
|
||||||
|
'schedulesWithTickets' => $schedulesWithTickets, // Pass schedules with tickets
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createAdmin($id)
|
||||||
|
{
|
||||||
|
$jadwal = new Jadwal();
|
||||||
|
$ticket = new Ticket();
|
||||||
|
|
||||||
|
$findPelanggan = $ticket->find($id);
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$existingJadwal = $jadwal->where('pelanggan_id', $findPelanggan['id_pelanggan'])
|
||||||
|
->where('status', '0')
|
||||||
|
->Where('type_jadwal', 'perbaikan')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($existingJadwal) {
|
||||||
|
return redirect()->to('dashboard/laporan')->with('error', 'You already have a pending ticket or a scheduled repair.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($existingJadwal);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'pelanggan_id' => $findPelanggan['id_pelanggan'],
|
||||||
|
'waktu_pemasangan' => $this->request->getPost('waktu_pemasangan'),
|
||||||
|
'ticket_id' => $id,
|
||||||
|
'type_jadwal' => 'perbaikan',
|
||||||
|
'status' => '0',
|
||||||
|
];
|
||||||
|
|
||||||
|
$create = $jadwal->insert($data);
|
||||||
|
|
||||||
|
if (!$create) {
|
||||||
|
return redirect()->to('dashboard/laporan')->with('error', 'Gagal membuat jadwal');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/laporan')->with('success', 'Berhasil membuat jadwal');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/lapor/create', [
|
||||||
|
'title' => 'Buat Jadwal',
|
||||||
|
'id' => $id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateAdmin($id)
|
||||||
|
{
|
||||||
|
$ticket = new Ticket();
|
||||||
|
if ($this->request->getMethod() === 'POST') {
|
||||||
|
$data = [
|
||||||
|
'keluhan' => $this->request->getPost('keluhan'),
|
||||||
|
'status' => $this->request->getPost('status'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = $ticket->update($id, $data);
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
|
return redirect()->to('dashboard/laporan/')->with('error', 'Gagal update paket');
|
||||||
|
}
|
||||||
|
return redirect()->to('dashboard/laporan/')->with('success', 'Berhasil update paket');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard/lapor/update', [
|
||||||
|
'title' => 'Update Laporan',
|
||||||
|
'data' => $ticket->find($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
use CodeIgniter\Database\RawSql;
|
||||||
|
|
||||||
|
class User extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->forge->addField([
|
||||||
|
'id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
'unsigned' => true,
|
||||||
|
'auto_increment' => true,
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 100,
|
||||||
|
],
|
||||||
|
'email' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 100,
|
||||||
|
],
|
||||||
|
'password' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255,
|
||||||
|
],
|
||||||
|
'usertype' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['admin', 'teknisi', 'pelanggan'],
|
||||||
|
'default' => 'pelanggan',
|
||||||
|
],
|
||||||
|
'created_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
'updated_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$this->forge->addKey('id', true);
|
||||||
|
$this->forge->createTable('users');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropTable('users');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
use CodeIgniter\Database\RawSql;
|
||||||
|
|
||||||
|
class Pelanggan extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->forge->addField([
|
||||||
|
'id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
'unsigned' => true,
|
||||||
|
'auto_increment' => true,
|
||||||
|
],
|
||||||
|
'pelanggan_id' => [
|
||||||
|
'type' => 'BIGINT',
|
||||||
|
'constraint' => 11,
|
||||||
|
'null' => true
|
||||||
|
],
|
||||||
|
'user_id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
],
|
||||||
|
'nomor_whatsapp' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255
|
||||||
|
],
|
||||||
|
'geolocation' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255
|
||||||
|
],
|
||||||
|
'alamat' => [
|
||||||
|
'type' => 'TEXT',
|
||||||
|
],
|
||||||
|
'foto_diri' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255
|
||||||
|
],
|
||||||
|
'paket' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['1', '0'],
|
||||||
|
'default' => '0',
|
||||||
|
],
|
||||||
|
'created_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
'updated_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$this->forge->addKey('id', true);
|
||||||
|
$this->forge->createTable('pelanggan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropTable('pelanggan');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
use CodeIgniter\Database\RawSql;
|
||||||
|
|
||||||
|
class Transaksi extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->forge->addField([
|
||||||
|
'id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
'unsigned' => true,
|
||||||
|
'auto_increment' => true,
|
||||||
|
],
|
||||||
|
'pelanggan_id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
],
|
||||||
|
'total' => [
|
||||||
|
'type' => 'BIGINT',
|
||||||
|
'constraint' => 255
|
||||||
|
],
|
||||||
|
'kategori_pembayaran' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['pasang_baru', 'bulanan'],
|
||||||
|
],
|
||||||
|
'type_pembayaran' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['1', '0'],
|
||||||
|
'default' => '0',
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['1', '0'],
|
||||||
|
'default' => '0',
|
||||||
|
],
|
||||||
|
'created_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
'updated_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$this->forge->addKey('id', true);
|
||||||
|
$this->forge->createTable('transaksi');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropTable('transaksi');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
use CodeIgniter\Database\RawSql;
|
||||||
|
|
||||||
|
class Jadwal extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->forge->addField([
|
||||||
|
'id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
'unsigned' => true,
|
||||||
|
'auto_increment' => true,
|
||||||
|
],
|
||||||
|
'teknisi_id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
],
|
||||||
|
'pelanggan_id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
],
|
||||||
|
'ticket_id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
'default' => null
|
||||||
|
],
|
||||||
|
'waktu_pemasangan' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255,
|
||||||
|
'default' => null
|
||||||
|
],
|
||||||
|
'bukti_kegiatan' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255,
|
||||||
|
'default' => null
|
||||||
|
],
|
||||||
|
'foto_pelanggan' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255,
|
||||||
|
'default' => null
|
||||||
|
],
|
||||||
|
'type_jadwal' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['instalasi_baru', 'perbaikan'],
|
||||||
|
'default' => 'instalasi_baru',
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['1', '0'],
|
||||||
|
'default' => '0',
|
||||||
|
],
|
||||||
|
'created_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
'updated_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
'on_update' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$this->forge->addKey('id', true);
|
||||||
|
$this->forge->createTable('jadwal');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropTable('jadwal');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
use CodeIgniter\Database\RawSql;
|
||||||
|
|
||||||
|
class Laporan extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->forge->addField([
|
||||||
|
'id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
'unsigned' => true,
|
||||||
|
'auto_increment' => true,
|
||||||
|
],
|
||||||
|
'author' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
],
|
||||||
|
'start_date' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255,
|
||||||
|
],
|
||||||
|
'end_date' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255,
|
||||||
|
],
|
||||||
|
'kategori' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['transaksi', 'jadwal'],
|
||||||
|
],
|
||||||
|
'created_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
'updated_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$this->forge->addKey('id', true);
|
||||||
|
$this->forge->createTable('laporan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropTable('laporan');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
use CodeIgniter\Database\RawSql;
|
||||||
|
|
||||||
|
class Paket extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->forge->addField([
|
||||||
|
'id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
'unsigned' => true,
|
||||||
|
'auto_increment' => true,
|
||||||
|
],
|
||||||
|
'nama' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255,
|
||||||
|
],
|
||||||
|
'kecepatan' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255,
|
||||||
|
],
|
||||||
|
'harga' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 255,
|
||||||
|
],
|
||||||
|
'created_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
'updated_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$this->forge->addKey('id', true);
|
||||||
|
$this->forge->createTable('paket');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropTable('paket');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
use CodeIgniter\Database\RawSql;
|
||||||
|
|
||||||
|
class Ticket extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->forge->addField([
|
||||||
|
'id' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
'unsigned' => true,
|
||||||
|
'auto_increment' => true,
|
||||||
|
],
|
||||||
|
'id_pelanggan' => [
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 11,
|
||||||
|
],
|
||||||
|
'keluhan' => [
|
||||||
|
'type' => 'TEXT',
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['1', '0'],
|
||||||
|
'default' => '0',
|
||||||
|
],
|
||||||
|
'created_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
'updated_at' => [
|
||||||
|
'type' => 'TIMESTAMP',
|
||||||
|
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$this->forge->addKey('id', true);
|
||||||
|
$this->forge->createTable('ticket');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropTable('ticket');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Seeds;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Seeder;
|
||||||
|
use App\Models\User as ModelUser;
|
||||||
|
|
||||||
|
class User extends Seeder
|
||||||
|
{
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'name' => 'admin',
|
||||||
|
'email' => 'admin@gmail.com',
|
||||||
|
'password' => password_hash('admin', PASSWORD_DEFAULT),
|
||||||
|
'usertype' => 'admin',
|
||||||
|
'created_at' => date('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$model = new ModelUser();
|
||||||
|
$model->insert($data);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filters;
|
||||||
|
|
||||||
|
use CodeIgniter\Filters\FilterInterface;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|
||||||
|
class IsAuthenticated implements FilterInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Do whatever processing this filter needs to do.
|
||||||
|
* By default it should not return anything during
|
||||||
|
* normal execution. However, when an abnormal state
|
||||||
|
* is found, it should return an instance of
|
||||||
|
* CodeIgniter\HTTP\Response. If it does, script
|
||||||
|
* execution will end and that Response will be
|
||||||
|
* sent back to the client, allowing for error pages,
|
||||||
|
* redirects, etc.
|
||||||
|
*
|
||||||
|
* @param RequestInterface $request
|
||||||
|
* @param array|null $arguments
|
||||||
|
*
|
||||||
|
* @return RequestInterface|ResponseInterface|string|void
|
||||||
|
*/
|
||||||
|
public function before(RequestInterface $request, $arguments = null)
|
||||||
|
{
|
||||||
|
if (!session()->isLoggedIn) {
|
||||||
|
return redirect()->to('/login')->with('error', 'Silahkan login terlebih dahulu!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows After filters to inspect and modify the response
|
||||||
|
* object as needed. This method does not allow any way
|
||||||
|
* to stop execution of other after filters, short of
|
||||||
|
* throwing an Exception or Error.
|
||||||
|
*
|
||||||
|
* @param RequestInterface $request
|
||||||
|
* @param ResponseInterface $response
|
||||||
|
* @param array|null $arguments
|
||||||
|
*
|
||||||
|
* @return ResponseInterface|void
|
||||||
|
*/
|
||||||
|
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filters;
|
||||||
|
|
||||||
|
use CodeIgniter\Filters\FilterInterface;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|
||||||
|
class IsAuthenticatedAs implements FilterInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Do whatever processing this filter needs to do.
|
||||||
|
* By default it should not return anything during
|
||||||
|
* normal execution. However, when an abnormal state
|
||||||
|
* is found, it should return an instance of
|
||||||
|
* CodeIgniter\HTTP\Response. If it does, script
|
||||||
|
* execution will end and that Response will be
|
||||||
|
* sent back to the client, allowing for error pages,
|
||||||
|
* redirects, etc.
|
||||||
|
*
|
||||||
|
* @param RequestInterface $request
|
||||||
|
* @param array|null $arguments
|
||||||
|
*
|
||||||
|
* @return RequestInterface|ResponseInterface|string|void
|
||||||
|
*/
|
||||||
|
public function before(RequestInterface $request, $arguments = null)
|
||||||
|
{
|
||||||
|
if (in_array(session()->userType, $arguments)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->to('/')->with('error', 'Akses dilarang.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows After filters to inspect and modify the response
|
||||||
|
* object as needed. This method does not allow any way
|
||||||
|
* to stop execution of other after filters, short of
|
||||||
|
* throwing an Exception or Error.
|
||||||
|
*
|
||||||
|
* @param RequestInterface $request
|
||||||
|
* @param ResponseInterface $response
|
||||||
|
* @param array|null $arguments
|
||||||
|
*
|
||||||
|
* @return ResponseInterface|void
|
||||||
|
*/
|
||||||
|
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// override core en language system validation or define your own en language validation message
|
||||||
|
return [];
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class Jadwal extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'jadwal';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'pelanggan_id', 'teknisi_id', 'ticket_id', 'waktu_pemasangan', 'bukti_kegiatan', 'foto_pelanggan','type_jadwal', 'status'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
public function isTechnicianAvailable($teknisi_id, $date)
|
||||||
|
{
|
||||||
|
return !$this->where('teknisi_id', $teknisi_id)
|
||||||
|
->where('waktu_pemasangan', $date)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class Laporan extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'laporan';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'author', 'start_date', 'end_date', 'kategori'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class Paket extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'paket';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'nama', 'kecepatan', 'harga'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class Pelanggan extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'pelanggan';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'pelanggan_id', 'user_id', 'nomor_whatsapp', 'geolocation',
|
||||||
|
'alamat', 'foto_diri', 'paket', 'status', 'created_at', 'updated_at'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class Ticket extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'ticket';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'id_pelanggan', 'keluhan', 'status'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class Transaksi extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'transaksi';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'pelanggan_id', 'total', 'status', 'type_pembayaran', 'kategori_pembayaran', 'updated_at'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class User extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'users';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = [
|
||||||
|
'name', 'email', 'password', 'usertype'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?= $this->extend('layout/auth') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="animate-slide-bottom-to-top text-gray-800 bg-white transition-all duration-300 md:rounded-2xl shadow-2xl w-[500px]">
|
||||||
|
<div class="my-10 mx-10">
|
||||||
|
<div class="mb-5">
|
||||||
|
<h1 class="text-center font-bold text-5xl mt-10 mb-5">BIMANET<span class="text-sky-500 font-bold text-6xl">.</span></h1>
|
||||||
|
<p class="text-center font-semibold text-gray-600">Silakan masuk ke akun Anda terlebih dahulu.</p>
|
||||||
|
</div>
|
||||||
|
<form id="loginForm" class="py-5">
|
||||||
|
<div class="block pt-2">
|
||||||
|
<label for="email" class="font-semibold text-gray-600">Email</label>
|
||||||
|
<input type="email" name="email" id="email" placeholder="Email" class="bg-gray-200 rounded-2xl py-4 px-5 w-full focus:outline-none">
|
||||||
|
</div>
|
||||||
|
<div class="block pt-2">
|
||||||
|
<label for="password" class="font-semibold text-gray-600">Password</label>
|
||||||
|
<input type="password" name="password" id="password" placeholder="*****" class="bg-gray-200 rounded-2xl py-4 px-5 w-full focus:outline-none">
|
||||||
|
</div>
|
||||||
|
<div class="block mt-10">
|
||||||
|
<button type="submit" class="bg-sky-500 hover:bg-sky-600 transition-colors duration-300 text-white text-1xl font-bold rounded-2xl py-4 px-5 w-full focus:outline-none">LOGIN</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="font-medium transition-colors">
|
||||||
|
<span class="text-gray-600">Tidak mempunyai akun? <a href="<?= base_url('register') ?>" class="text-sky-500 hover:text-sky-600 duration-300">Register</a></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="py-10 font-semibold text-gray-500">
|
||||||
|
<a href="<?= base_url('/') ?>" class="items-center flex justify-center">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 mr-3">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18" />
|
||||||
|
</svg>
|
||||||
|
Kembali
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('script') ?>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#loginForm').on('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var formData = $(this).serialize();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url('/login') ?>',
|
||||||
|
type: 'POST',
|
||||||
|
data: formData,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status === 'success') {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Success!',
|
||||||
|
text: response.message,
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
})
|
||||||
|
|
||||||
|
window.location.href = response.redirect;
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error!',
|
||||||
|
text: response.message,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error!',
|
||||||
|
text: 'An error occurred. Please try again.',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?= $this->extend('layout/auth') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="animate-slide-top-to-bottom text-gray-800 bg-white transition-all duration-300 md:rounded-2xl shadow-2xl w-[500px]">
|
||||||
|
<div class="my-10 mx-10">
|
||||||
|
<div class="mb-5">
|
||||||
|
<h1 class="text-center font-bold text-5xl mt-10 mb-5">BIMANET<span class="text-sky-500 font-bold text-6xl">.</span></h1>
|
||||||
|
<p class="text-center font-semibold text-gray-600">Tolong melengkapi proses pendaftaran sebagai pelanggan.</p>
|
||||||
|
</div>
|
||||||
|
<form id="formRegister" class="py-5">
|
||||||
|
<div class="block pt-2">
|
||||||
|
<label for="" class="font-semibold text-gray-600">Nama</label>
|
||||||
|
<input type="text" name="name" id="name" placeholder="Nama" class="bg-gray-200 rounded-2xl py-4 px-5 w-full focus:outline-none">
|
||||||
|
</div>
|
||||||
|
<div class="block pt-2">
|
||||||
|
<label for="" class="font-semibold text-gray-600">Email</label>
|
||||||
|
<input type="email" name="email" id="email" placeholder="Email" class="bg-gray-200 rounded-2xl py-4 px-5 w-full focus:outline-none">
|
||||||
|
</div>
|
||||||
|
<div class="block pt-2">
|
||||||
|
<label for="" class="font-semibold text-gray-600">Password</label>
|
||||||
|
<input type="password" name="password" id="password" placeholder="Password" class="bg-gray-200 rounded-2xl py-4 px-5 w-full focus:outline-none">
|
||||||
|
</div>
|
||||||
|
<div class="block mt-10">
|
||||||
|
<button type="submit" class="bg-sky-500 hover:bg-sky-600 transition-colors duration-300 text-white text-1xl font-bold rounded-2xl py-4 px-5 w-full focus:outline-none">REGISTER</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="font-medium transition-colors">
|
||||||
|
<span class="text-gray-600">Apakah Anda sudah memiliki akun? <a href="<?= base_url('/login') ?>" class="text-sky-500 hover:text-sky-600 duration-300">Login</a></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="py-10 font-semibold text-gray-500">
|
||||||
|
<a href="<?= base_url('/') ?>" class="items-center flex justify-center">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 mr-3">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18" />
|
||||||
|
</svg>
|
||||||
|
Kembali
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('script') ?>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#formRegister').on('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var formData = $(this).serialize();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url('/register') ?>',
|
||||||
|
type: 'POST',
|
||||||
|
data: formData,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status === 'success') {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Success!',
|
||||||
|
text: response.message,
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
})
|
||||||
|
|
||||||
|
window.location.href = response.redirect;
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error!',
|
||||||
|
text: response.message,
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error!',
|
||||||
|
text: 'An error occurred. Please try again.',
|
||||||
|
icon: 'error',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php if(session()->has('success')): ?>
|
||||||
|
<div id="successMessage" class="bg-green-500 text-white rounded-lg p-2 text-center">
|
||||||
|
<?= session('success') ?>
|
||||||
|
</div>
|
||||||
|
<?php elseif(session()->has('error')): ?>
|
||||||
|
<div id="errorMessage" class="bg-red-500 text-white rounded-lg p-2 text-center">
|
||||||
|
<?= session('error') ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Function to fade out a message after 3 seconds
|
||||||
|
function fadeOutMessage(messageId) {
|
||||||
|
setTimeout(function() {
|
||||||
|
var message = document.getElementById(messageId);
|
||||||
|
message.style.transition = "opacity 1s";
|
||||||
|
message.style.opacity = "0";
|
||||||
|
setTimeout(function() {
|
||||||
|
message.style.display = "none";
|
||||||
|
}, 1000);
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call fadeOutMessage for success and error messages
|
||||||
|
if (document.getElementById('successMessage')) {
|
||||||
|
fadeOutMessage('successMessage');
|
||||||
|
}
|
||||||
|
if (document.getElementById('errorMessage')) {
|
||||||
|
fadeOutMessage('errorMessage');
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<h1 class="mb-5 text-4xl font-extralight">
|
||||||
|
Selamat datang, <span class="font-bold text-sky-500"><?= session()->name ?>!</span>
|
||||||
|
</h1>
|
||||||
|
<?php if(session()->userType === 'admin'): ?>
|
||||||
|
<div class="grid gap-4 grid-cols-3">
|
||||||
|
<div>
|
||||||
|
<div class="bg-gray-800 rounded-lg p-5 text-white flex justify-between items-center">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 mr-3">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" />
|
||||||
|
</svg>
|
||||||
|
<div>
|
||||||
|
<h1 class="font-semibold uppercase text-xl">Paket</h1>
|
||||||
|
<p><?= $paketCount ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="bg-gray-800 rounded-lg p-5 text-white flex justify-between items-center">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 mr-3">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" />
|
||||||
|
</svg>
|
||||||
|
<div>
|
||||||
|
<h1 class="font-semibold uppercase text-xl">Pelanggan</h1>
|
||||||
|
<p><?= $pelangganCount ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="bg-gray-800 rounded-lg p-5 text-white flex justify-between items-center">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 mr-3">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M3 7.5 7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5" />
|
||||||
|
</svg>
|
||||||
|
<div>
|
||||||
|
<h1 class="font-semibold uppercase text-xl">Transaksi</h1>
|
||||||
|
<p><?= $transaksiCount ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid gap-5 grid-cols-2 py-5">
|
||||||
|
<div>
|
||||||
|
<canvas id="dataTransaksi"></canvas>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<canvas id="dataPemasangan"></canvas>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('script') ?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const pemasanganData = <?= json_encode($dataPemasangan) ?>;
|
||||||
|
const transaksiData = <?= json_encode($dataTransaksi) ?>;
|
||||||
|
|
||||||
|
const pemasanganLabels = pemasanganData.map(item => item.label);
|
||||||
|
const pemasanganValues = pemasanganData.map(item => item.value);
|
||||||
|
|
||||||
|
const transaksiLabels = transaksiData.map(item => item.label);
|
||||||
|
const transaksiValues = transaksiData.map(item => item.value);
|
||||||
|
|
||||||
|
const dataPemasanganCtx = document.getElementById('dataPemasangan').getContext('2d');
|
||||||
|
new Chart(dataPemasanganCtx, {
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: pemasanganLabels,
|
||||||
|
datasets: [{
|
||||||
|
label: 'Data Pemasangan',
|
||||||
|
data: pemasanganValues,
|
||||||
|
borderWidth: 1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
scales: {
|
||||||
|
y: {
|
||||||
|
beginAtZero: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const dataTransaksiCtx = document.getElementById('dataTransaksi').getContext('2d');
|
||||||
|
new Chart(dataTransaksiCtx, {
|
||||||
|
type: 'line',
|
||||||
|
data: {
|
||||||
|
labels: transaksiLabels,
|
||||||
|
datasets: [{
|
||||||
|
label: 'Data Transaksi',
|
||||||
|
data: transaksiValues,
|
||||||
|
borderWidth: 1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
scales: {
|
||||||
|
y: {
|
||||||
|
beginAtZero: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,110 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="bg-gray-200 rounded-lg p-5 px-10 shadow-xl">
|
||||||
|
<div>
|
||||||
|
<table id="myTable" class="w-full">
|
||||||
|
<thead>
|
||||||
|
<tr class="text-left">
|
||||||
|
<th class="py-3">#</th>
|
||||||
|
<th class="py-3">Nama Pelanggan</th>
|
||||||
|
<th class="py-3">Geolocation</th>
|
||||||
|
<th class="py-3">Alamat</th>
|
||||||
|
<th class="py-3">Bukti Kegiatan</th>
|
||||||
|
<th class="py-3">Foto Pelanggan</th>
|
||||||
|
<th class="py-3">Keterangan</th>
|
||||||
|
<th class="py-3">Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($data as $index => $item) : ?>
|
||||||
|
<tr class="text-left">
|
||||||
|
<td class="py-3"><?= $index + 1 ?></td>
|
||||||
|
<td class="py-3"><?= $item['name'] ?></td>
|
||||||
|
<td class="py-3"><a href="https://www.google.com/maps/dir/Current+Location/<?= $item['geolocation'] ?>" class="text-blue-500" target="_blank"><?= $item['geolocation'] ?></a></td>
|
||||||
|
<td class="py-3"><?= $item['alamat'] ?></td>
|
||||||
|
<td class="py-3">
|
||||||
|
<div class="cursor-pointer text-sky-500 hover:text-sky-600" onclick="enlargeImage('<?= base_url('uploads/' . $item['bukti_kegiatan']) ?>')">
|
||||||
|
<?= $item['bukti_kegiatan'] ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="py-3">
|
||||||
|
<div class="cursor-pointer text-sky-500 hover:text-sky-600" onclick="enlargeImage('<?= base_url('uploads/') ?><?= $item['foto_pelanggan'] ?>')">
|
||||||
|
<?= $item['foto_pelanggan'] ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="py-3">
|
||||||
|
<?php if($item['type_jadwal'] == 'instalasi_baru'): ?>
|
||||||
|
<?= $item['status'] === '0' ? 'Pemasangan diproses' : 'Pemasangan berhasil' ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= $item['status'] === '0' ? 'Perbaikan diproses' : 'Sudah perbaikan' ?>
|
||||||
|
<?php endif ?>
|
||||||
|
</td>
|
||||||
|
<td class="text-white flex gap-2">
|
||||||
|
<?php if (session()->userType === 'teknisi') : ?>
|
||||||
|
<?php if ($item['waktu_pemasangan'] === null) : ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<a href="<?= base_url('dashboard/jadwal/update/' . $item['id']) ?>" class="bg-sky-500 p-2 rounded-lg">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php if (session()->userType !== 'teknisi') : ?>
|
||||||
|
<a href="<?= base_url('dashboard/jadwal/update/' . $item['id']) ?>" class="bg-sky-500 p-2 rounded-lg">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<a href="javascript:void(0)" onclick="confirmDelete('<?= base_url('dashboard/jadwal/delete/' . $item['id']) ?>')" class="bg-red-500 p-2 rounded-lg">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<?php endif ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('script') ?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#myTable').DataTable();
|
||||||
|
});
|
||||||
|
|
||||||
|
function enlargeImage(imageUrl) {
|
||||||
|
var modal = document.createElement('div');
|
||||||
|
modal.classList.add('fixed', 'top-0', 'left-0', 'w-full', 'h-full', 'bg-black', 'bg-opacity-75', 'flex', 'justify-center', 'items-center', 'z-50');
|
||||||
|
|
||||||
|
var enlargedImg = document.createElement('img');
|
||||||
|
enlargedImg.src = imageUrl;
|
||||||
|
enlargedImg.classList.add('max-w-full', 'max-h-full');
|
||||||
|
|
||||||
|
modal.appendChild(enlargedImg);
|
||||||
|
|
||||||
|
document.body.appendChild(modal);
|
||||||
|
|
||||||
|
modal.addEventListener('click', function(event) {
|
||||||
|
if (event.target === modal) {
|
||||||
|
modal.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmDelete(deleteUrl) {
|
||||||
|
if (confirm("Are you sure you want to delete this item?")) {
|
||||||
|
window.location.href = deleteUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,110 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="py-5 w-full">
|
||||||
|
<?php if (session()->has('success')) : ?>
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<?= session('success') ?>
|
||||||
|
</div>
|
||||||
|
<?php elseif (session()->has('error')) : ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?= session('error') ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form action="<?= base_url('dashboard/jadwal/update/'.$data['id']) ?>" method="POST" enctype="multipart/form-data">
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="waktu_pemasangan" class="block font-medium text-gray-700">Waktu Pelaksanaan</label>
|
||||||
|
<input type="date" id="waktu_pemasangan" name="waktu_pemasangan" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['waktu_pemasangan'] ?>" required <?= session()->userType === 'admin' ? '' : 'disabled' ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="teknisi_id" class="block font-medium text-gray-700">Teknisi</label>
|
||||||
|
<select <?= session()->userType === 'admin' ? '' : 'disabled' ?> id="teknisi_id" name="teknisi_id" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" required>
|
||||||
|
<option value="" disabled selected>Pilih Teknisi</option>
|
||||||
|
<?php foreach ($teknisi as $technician): ?>
|
||||||
|
<option value="<?= $technician['id'] ?>" <?= $technician['id'] == $data['teknisi_id'] ? 'selected' : '' ?>>
|
||||||
|
<?= $technician['name'] ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="bukti_kegiatan" class="block font-medium text-gray-700">Bukti Instalasi</label>
|
||||||
|
<input type="file" id="bukti_kegiatan" name="bukti_kegiatan" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full">
|
||||||
|
<?php if (!empty($data['bukti_kegiatan'])): ?>
|
||||||
|
<p class="mt-2">Current file: <?= $data['bukti_kegiatan'] ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="foto_pelanggan" class="block font-medium text-gray-700">Foto Dengan Pelanggan</label>
|
||||||
|
<input type="file" id="foto_pelanggan" name="foto_pelanggan" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full">
|
||||||
|
<?php if (!empty($data['foto_pelanggan'])): ?>
|
||||||
|
<p class="mt-2">Current file: <?= $data['foto_pelanggan'] ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="type_jadwal" class="block font-medium text-gray-700">Tipe Jadwal</label>
|
||||||
|
<select disabled name="type_jadwal" id="type_jadwal" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full">
|
||||||
|
<option value="instalasi_baru" <?= $data['type_jadwal'] === 'instalasi_baru' ? 'selected' : '' ?>>Instalasi Baru</option>
|
||||||
|
<option value="perbaikan" <?= $data['type_jadwal'] === 'perbaikan' ? 'selected' : '' ?>>Perbaikan</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="status" class="block font-medium text-gray-700">Status</label>
|
||||||
|
<select <?= session()->userType === 'admin' ? '' : 'disabled' ?> name="status" id="status" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full">
|
||||||
|
<option value="1" <?= $data['status'] === '1' ? 'selected' : '' ?>>Sudah Terpasang</option>
|
||||||
|
<option value="0" <?= $data['status'] === '0' ? 'selected' : '' ?>>Belum Terpasang</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block mt-5">
|
||||||
|
<button type="submit" class="bg-sky-500 rounded-lg p-2 text-white">Simpan</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('waktu_pemasangan').addEventListener('change', function() {
|
||||||
|
const waktuPemasangan = this.value;
|
||||||
|
const id = <?= $data['id'] ?>;
|
||||||
|
fetch(`<?= base_url('dashboard/jadwal/update') ?>/${id}?waktu_pemasangan=${waktuPemasangan}`, {
|
||||||
|
method: 'GET', // Adjust the method to GET
|
||||||
|
headers: {
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
const teknisiSelect = document.getElementById('teknisi_id');
|
||||||
|
teknisiSelect.innerHTML = '<option value="" disabled selected>Pilih Teknisi</option>';
|
||||||
|
data.teknisi.forEach(technician => {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = technician.id;
|
||||||
|
option.textContent = technician.name;
|
||||||
|
teknisiSelect.appendChild(option);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(error => console.error('Error fetching technicians:', error));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="flex justify-center items-center">
|
||||||
|
<div class="w-full">
|
||||||
|
<?php if (session()->has('message')) : ?>
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<?= session('message') ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="<?= base_url('dashboard/laporan/create/jadwal/'.$id) ?>" method="POST">
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="waktu_pemasangan" class="block font-medium text-black">Waktu Pelaksanaan</label>
|
||||||
|
<input type="date" id="waktu_pemasangan" name="waktu_pemasangan" class="mt-1 p-2 bg-gray-200 text-gray-500 rounded-lg w-full" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block mt-5">
|
||||||
|
<button type="submit" class="transition duration-300 bg-[#5AB2FF] rounded-lg py-2 px-5 text-white border-2 border-white font-bold">Kirim</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('script') ?>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,100 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="">
|
||||||
|
<div class="bg-gray-200 text-gray-800 rounded-lg p-5 px-10 shadow-xl">
|
||||||
|
<div>
|
||||||
|
<table id="myTable" class="w-full">
|
||||||
|
<thead>
|
||||||
|
<tr class="text-left">
|
||||||
|
<th class="py-3">#</th>
|
||||||
|
<th class="py-3">Keluhan</th>
|
||||||
|
<th class="py-3">Nama Pelanggan</th>
|
||||||
|
<th class="py-3">Nomor Pelanggan</th>
|
||||||
|
<th class="py-3">Foto Pelanggan</th>
|
||||||
|
<th class="py-3">Status</th>
|
||||||
|
<th class="py-3">Tanggal</th>
|
||||||
|
<th class="py-3">Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach($data as $index => $item): ?>
|
||||||
|
<tr class="text-left">
|
||||||
|
<td class="py-3"><?= $index + 1 ?></td>
|
||||||
|
<td class="py-3"><?= $item['keluhan'] ?></td>
|
||||||
|
<td class="py-3"><?= $item['nama'] ?></td>
|
||||||
|
<td class="py-3"><?= $item['nomor'] ?></td>
|
||||||
|
<td class="py-3">
|
||||||
|
<div
|
||||||
|
class="cursor-pointer text-blue-500 w-fit p-1 rounded-lg px-3"
|
||||||
|
onclick="enlargeImage('<?= base_url('uploads/') ?><?= $item['foto_pelanggan'] ?>')"
|
||||||
|
>
|
||||||
|
<?= $item['foto_pelanggan'] ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="py-3"><span class="py-1 px-3 rounded-lg text-white <?= $item['status'] === '0' ? 'bg-yellow-500': 'bg-green-500' ?>"><?= $item['status'] === '0' ? 'Pending' : 'Success'?></span></td>
|
||||||
|
<td class="py-3"><?= $item['created_at'] ?></td>
|
||||||
|
<td class="text-white flex gap-2">
|
||||||
|
<?php if($item['status'] === '0' ): ?>
|
||||||
|
<a href="<?= base_url('dashboard/laporan/create/jadwal/'. $item['id']) ?>" class="bg-green-500 p-2 rounded-lg ${isTicketExist ? 'pointer-events-none opacity-50' : ''}">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008Zm-2.25-2.25h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm0-4.5h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008ZM10.5 12h.008v.008H10.5V12Zm0 2.25h.008v.008H10.5v-.008ZM13.5 12h.008v.008H13.5V12Zm0 2.25h.008v.008H13.5v-.008Zm0-4.5h.008v.008H13.5V12Zm0 2.25h.008v.008H13.5v-.008Zm3 0h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5v-.008Zm0-4.5h.008v.008H16.5V12Z" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<?php endif ?>
|
||||||
|
<a href="<?= base_url('dashboard/laporan/update/'. $item['id']) ?>" class="bg-sky-500 p-2 rounded-lg">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<a href="javascript:void(0)" onclick="confirmDelete('<?= base_url('dashboard/laporan/delete/'. $item['id']) ?>" class="bg-red-500 p-2 rounded-lg">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div id="pagination" class="mt-5"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('script') ?>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#myTable').DataTable();
|
||||||
|
});
|
||||||
|
|
||||||
|
function enlargeImage(imageUrl) {
|
||||||
|
var modal = document.createElement('div');
|
||||||
|
modal.classList.add('fixed', 'top-0', 'left-0', 'w-full', 'h-full', 'bg-black', 'bg-opacity-75', 'flex', 'justify-center', 'items-center', 'z-50');
|
||||||
|
|
||||||
|
var enlargedImg = document.createElement('img');
|
||||||
|
enlargedImg.src = imageUrl;
|
||||||
|
enlargedImg.classList.add('max-w-full', 'max-h-full');
|
||||||
|
|
||||||
|
modal.appendChild(enlargedImg);
|
||||||
|
|
||||||
|
document.body.appendChild(modal);
|
||||||
|
|
||||||
|
modal.addEventListener('click', function(event) {
|
||||||
|
if (event.target === modal) {
|
||||||
|
modal.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmDelete(deleteUrl) {
|
||||||
|
if (confirm("Are you sure you want to delete this item?")) {
|
||||||
|
window.location.href = deleteUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="flex justify-center items-center">
|
||||||
|
<div class="w-full">
|
||||||
|
<?php if (session()->has('message')) : ?>
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<?= session('message') ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="<?= base_url('dashboard/laporan/update/'.$data['id']) ?>" method="POST">
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="keluhan" class="block font-medium text-black">Keluhan</label>
|
||||||
|
<textarea type="text" id="keluhan" name="keluhan" class="mt-1 p-2 bg-gray-200 text-gray-500 rounded-lg w-full" required><?= $data['keluhan'] ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block mt-5">
|
||||||
|
<button type="submit" class="transition duration-300 bg-[#5AB2FF] rounded-lg py-2 px-5 text-white border-2 border-white font-bold">Kirim</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('script') ?>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="py-5 w-full">
|
||||||
|
<?php if (session()->has('message')) : ?>
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<?= session('message') ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="<?= base_url('dashboard/paket/create') ?>" method="post">
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="nama" class="block font-medium text-gray-700">Nama Paket</label>
|
||||||
|
<input type="text" id="nama" name="nama" placeholder="Masukan Nama" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="kecepatan" class="block font-medium text-gray-700">Kecepatan (MB/s)</label>
|
||||||
|
<input type="number" id="kecepatan" name="kecepatan" placeholder="Masukan Kecepatan" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="harga" class="block font-medium text-gray-700">Harga</label>
|
||||||
|
<input type="number" id="harga" name="harga" placeholder="Masukan Harga" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block mt-5">
|
||||||
|
<button type="submit" class="bg-sky-500 rounded-lg p-2 text-white">Simpan</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<a href="<?= base_url('dashboard/paket/create') ?>">
|
||||||
|
<div class="flex items-center bg-sky-500 p-2 rounded-lg text-white">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
|
||||||
|
</svg>
|
||||||
|
Tambah
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-gray-200 rounded-lg p-5 px-10 shadow-xl">
|
||||||
|
<div>
|
||||||
|
<table id="myTable" class="w-full">
|
||||||
|
<thead>
|
||||||
|
<tr class="text-left">
|
||||||
|
<th class="py-3">#</th>
|
||||||
|
<th class="py-3">Nama Paket</th>
|
||||||
|
<th class="py-3">Kecepatan</th>
|
||||||
|
<th class="py-3">Harga</th>
|
||||||
|
<th class="py-3">Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach($data as $index => $item): ?>
|
||||||
|
<tr>
|
||||||
|
<td class="text-left"><?= $index + 1 ?></td>
|
||||||
|
<td><?= $item['nama'] ?></td>
|
||||||
|
<td><?= $item['kecepatan'] ?></td>
|
||||||
|
<td><?= 'Rp ' . number_format($item['harga'], 0, ',', '.') ?></td>
|
||||||
|
<td class="text-white flex gap-2">
|
||||||
|
<a href="<?= base_url('dashboard/paket/update/') ?>${item['id']}" class="bg-sky-500 p-2 rounded-lg">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<a href="javascript:void(0)" onclick="confirmDelete('<?= base_url('dashboard/paket/delete/') ?>${item['id']}')" class="bg-red-500 p-2 rounded-lg">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('script') ?>
|
||||||
|
<script>
|
||||||
|
$(document).ready( function () {
|
||||||
|
$('#myTable').DataTable();
|
||||||
|
} );
|
||||||
|
|
||||||
|
function confirmDelete(deleteUrl) {
|
||||||
|
if (confirm("Are you sure you want to delete this item?")) {
|
||||||
|
window.location.href = deleteUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="py-5 w-full">
|
||||||
|
<?php if (session()->has('message')) : ?>
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<?= session('message') ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="<?= base_url('dashboard/paket/update/'.$data['id']) ?>" method="POST">
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="nama" class="block font-medium text-gray-700">Nama Paket</label>
|
||||||
|
<input type="text" id="nama" name="nama" placeholder="Masukan Nama" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['nama'] ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="kecepatan" class="block font-medium text-gray-700">Kecepatan (MB/s)</label>
|
||||||
|
<input type="number" id="kecepatan" name="kecepatan" placeholder="Masukan Kecepatan" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['kecepatan'] ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="harga" class="block font-medium text-gray-700">Harga</label>
|
||||||
|
<input type="number" id="harga" name="harga" placeholder="Masukan Harga" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['harga'] ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block mt-5">
|
||||||
|
<button type="submit" class="bg-sky-500 rounded-lg p-2 text-white">Simpan</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<div class="py-5">
|
||||||
|
<div class="bg-gray-200 rounded-lg flex p-2 text-gray-400">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 mr-3">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
|
||||||
|
</svg>
|
||||||
|
<input type="text" id="searchInput" placeholder="Cari data.." class="bg-gray-200 focus:outline-none">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-gray-200 rounded-lg p-5 px-10 shadow-xl">
|
||||||
|
<div>
|
||||||
|
<table id="myTable" class="w-full">
|
||||||
|
<thead>
|
||||||
|
<tr class="text-left">
|
||||||
|
<th class="py-3">#</th>
|
||||||
|
<th class="py-3">Nama Pelanggan</th>
|
||||||
|
<th class="py-3">Email</th>
|
||||||
|
<th class="py-3">Nomor WhatsApp</th>
|
||||||
|
<th class="py-3">Alamat</th>
|
||||||
|
<th class="py-3">Foto Pelanggan</th>
|
||||||
|
<th class="py-3">Paket</th>
|
||||||
|
<th class="py-3">Status</th>
|
||||||
|
<th class="py-3">Aksi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="w-full">
|
||||||
|
<?php foreach($data as $index => $item): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= $index + 1 ?></td>
|
||||||
|
<td><?= $item['nama'] ?></td>
|
||||||
|
<td><?= $item['email'] ?></td>
|
||||||
|
<td><?= $item['nomor_whatsapp'] ?></td>
|
||||||
|
<td><?= $item['alamat'] ?></td>
|
||||||
|
<td>
|
||||||
|
<div
|
||||||
|
class="cursor-pointer bg-sky-500 text-white w-fit p-1 rounded-lg px-3"
|
||||||
|
onclick="enlargeImage('<?= base_url('uploads/') ?><?= $item['foto_diri'] ?>')"
|
||||||
|
>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><?= $item['nama_paket'] ?> - Bandwith <?= $item['kecepatan_paket'] ?> Mbps</td>
|
||||||
|
<td><?= $item['status'] === '0' ? 'Tidak Aktif' : 'Aktif' ?></td>
|
||||||
|
<td class="text-white flex gap-2">
|
||||||
|
<?php if ($item['status'] === '1') : ?>
|
||||||
|
<a href="<?= base_url('dashboard/pelanggan/tagihan/bulanan/'.$item['id']) ?>" class="bg-green-500 p-2 rounded-lg">
|
||||||
|
Tambah Tagihan
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<a href="<?= base_url('dashboard/pelanggan/update/') ?><?= $item['id'] ?>" class="bg-sky-500 p-2 rounded-lg">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div id="pagination" class="mt-5"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('script') ?>
|
||||||
|
<script>
|
||||||
|
$(document).ready( function () {
|
||||||
|
$('#myTable').DataTable();
|
||||||
|
} );
|
||||||
|
|
||||||
|
function enlargeImage(imageUrl) {
|
||||||
|
var modal = document.createElement('div');
|
||||||
|
modal.classList.add('fixed', 'top-0', 'left-0', 'w-full', 'h-full', 'bg-black', 'bg-opacity-75', 'flex', 'justify-center', 'items-center', 'z-50');
|
||||||
|
|
||||||
|
var enlargedImg = document.createElement('img');
|
||||||
|
enlargedImg.src = imageUrl;
|
||||||
|
enlargedImg.classList.add('max-w-full', 'max-h-full');
|
||||||
|
|
||||||
|
modal.appendChild(enlargedImg);
|
||||||
|
|
||||||
|
document.body.appendChild(modal);
|
||||||
|
|
||||||
|
modal.addEventListener('click', function(event) {
|
||||||
|
if (event.target === modal) {
|
||||||
|
modal.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmDelete(deleteUrl) {
|
||||||
|
if (confirm("Are you sure you want to delete this item?")) {
|
||||||
|
window.location.href = deleteUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="py-5 w-full">
|
||||||
|
<?php if (session()->has('message')) : ?>
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<?= session('message') ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="<?= base_url('dashboard/pelanggan/update/'. $data['id']) ?>" method="post">
|
||||||
|
<div class="hidden">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="user_id" class="block font-medium text-gray-700">User ID</label>
|
||||||
|
<input type="number" id="user_id" name="user_id" placeholder="Masukkan User ID" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['user_id'] ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="nomor_whatsapp" class="block font-medium text-gray-700">Nomor WhatsApp</label>
|
||||||
|
<input type="number" id="nomor_whatsapp" name="nomor_whatsapp" placeholder="Masukkan Nomor WhatsApp" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['nomor_whatsapp'] ?>" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="geolocation" class="block font-medium text-gray-700">Geolocation</label>
|
||||||
|
<input type="text" id="geolocation" name="geolocation" placeholder="Masukkan Geolocation" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['geolocation'] ?>" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="alamat" class="block font-medium text-gray-700">Alamat</label>
|
||||||
|
<input type="text" id="alamat" name="alamat" placeholder="Masukkan Alamat" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['alamat'] ?>" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="paket" class="block font-medium text-gray-700">Paket</label>
|
||||||
|
<input type="text" id="paket" name="paket" placeholder="Masukkan Paket" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['paket'] ?>" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="hidden">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="foto_diri" class="block font-medium text-gray-700">Foto Diri</label>
|
||||||
|
<input type="text" id="foto_diri" name="foto_diri" placeholder="Masukkan Foto Diri" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['foto_diri'] ?>" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="status" class="block font-medium text-gray-700">Status</label>
|
||||||
|
<select name="status" id="status" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full">
|
||||||
|
<option value="1" <?= $data['status'] == 1 ? 'selected' : '' ?>>Aktif</option>
|
||||||
|
<option value="0" <?= $data['status'] == 0 ? 'selected' : '' ?>>Tidak Aktif</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block mt-5">
|
||||||
|
<button type="submit" class="bg-sky-500 rounded-lg p-2 text-white">Simpan</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?= $this->extend('layout/app') ?>
|
||||||
|
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
|
||||||
|
<div class="py-5 w-full">
|
||||||
|
<form action="<?= base_url('dashboard/profile/'. session()->id) ?>" method="POST">
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="name" class="block font-medium text-gray-700">Nama User</label>
|
||||||
|
<input type="text" id="name" name="name" placeholder="Masukan Name" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['name'] ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="email" class="block font-medium text-gray-700">Email</label>
|
||||||
|
<input type="email" id="email" name="email" placeholder="Masukan Email" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="<?= $data['email'] ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block mt-5">
|
||||||
|
<button type="submit" class="bg-sky-500 rounded-lg p-2 text-white">Simpan</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="py-5 w-full">
|
||||||
|
<form action="<?= base_url('dashboard/profile/password/'. session()->id) ?>" method="POST">
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="password" class="block font-medium text-gray-700">Password Lama</label>
|
||||||
|
<input type="password" id="old_password" name="old_password" placeholder="Password Lama" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="password" class="block font-medium text-gray-700">Password Baru</label>
|
||||||
|
<input type="password" id="new_password" name="new_password" placeholder="Password Baru" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="w-1/2 mt-5">
|
||||||
|
<label for="konfirmasi_password" class="block font-medium text-gray-700">Konfirmasi Password Baru</label>
|
||||||
|
<input type="password" id="konfirmasi_new_password" name="konfirmasi_new_password" placeholder="Konfirmasi Password Baru" class="mt-1 p-2 bg-gray-200 rounded-lg focus:outline-none w-full" value="" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block mt-5">
|
||||||
|
<button type="submit" class="bg-sky-500 rounded-lg p-2 text-white">Simpan</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= $this->endSection() ?>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue