Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51860cea37 | |||
| f1618c1ffd | |||
| 162f246acc | |||
| 95997841cf | |||
| 9ff4393313 | |||
| 5bc5d286b4 | |||
| 5826f92661 | |||
| 2fa36eabf7 | |||
| 237a5aa44b | |||
| e1878e31e4 | |||
| 043c1fa83b | |||
| b8cf2a172d | |||
| 2451969c88 | |||
| bc95a60009 | |||
| cb0b80428b | |||
| da7883919e | |||
| f998d6e7dc | |||
| 0aaf81f1cb | |||
| 42c2c80726 | |||
| 600cd753f0 | |||
| 6898a78506 | |||
| 2ebeae54ea | |||
| dde4d910bb | |||
| 4f5edb69fb | |||
| 1075d7d585 |
@@ -0,0 +1,16 @@
|
|||||||
|
.git
|
||||||
|
.gitea
|
||||||
|
node_modules
|
||||||
|
vendor
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
storage/logs
|
||||||
|
storage/framework/cache
|
||||||
|
storage/framework/sessions
|
||||||
|
storage/framework/views
|
||||||
|
storage/debugbar
|
||||||
|
npm-debug.log
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yml
|
||||||
|
docker-compose.staging.yml
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
APP_NAME=Lumen
|
||||||
|
APP_ENV=staging
|
||||||
|
APP_KEY=WbPGkYNmXZ6ZQplGlvl0iZ7zyW1b09xa
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://127.0.0.1:8090
|
||||||
|
APP_TIMEZONE=Asia/Kuala_Lumpur
|
||||||
|
|
||||||
|
# Unique host ports — change these if they collide with other containers on the server.
|
||||||
|
# Host nginx should proxy the staging domain to 127.0.0.1:${HTTP_PORT}
|
||||||
|
HTTP_PORT=8090
|
||||||
|
MYSQL_PUBLISH_PORT=3308
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
LOG_SLACK_WEBHOOK_URL=
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=mysql
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=erahn_xtra
|
||||||
|
DB_USERNAME=root
|
||||||
|
DB_PASSWORD=root
|
||||||
|
|
||||||
|
DB_CONNECTION_7=mysql
|
||||||
|
DB_HOST_7=mysql
|
||||||
|
DB_PORT_7=3306
|
||||||
|
DB_DATABASE_7=master_erahn
|
||||||
|
DB_USERNAME_7=root
|
||||||
|
DB_PASSWORD_7=root
|
||||||
|
|
||||||
|
DB_CONNECTION_2=mysql
|
||||||
|
DB_HOST_2=mysql
|
||||||
|
DB_PORT_2=3306
|
||||||
|
DB_DATABASE_2=erahn_xtra
|
||||||
|
DB_USERNAME_2=root
|
||||||
|
DB_PASSWORD_2=root
|
||||||
|
|
||||||
|
DB_CONNECTION_3=mysql
|
||||||
|
DB_HOST_3=mysql
|
||||||
|
DB_PORT_3=3306
|
||||||
|
DB_DATABASE_3=erahn_baling
|
||||||
|
DB_USERNAME_3=root
|
||||||
|
DB_PASSWORD_3=root
|
||||||
|
|
||||||
|
DB_CONNECTION_4=mysql
|
||||||
|
DB_HOST_4=mysql
|
||||||
|
DB_PORT_4=3306
|
||||||
|
DB_DATABASE_4=arrahn_ld
|
||||||
|
DB_USERNAME_4=root
|
||||||
|
DB_PASSWORD_4=root
|
||||||
|
|
||||||
|
DB_CONNECTION_5=mysql
|
||||||
|
DB_HOST_5=mysql
|
||||||
|
DB_PORT_5=3306
|
||||||
|
DB_DATABASE_5=erahn_segamat
|
||||||
|
DB_USERNAME_5=root
|
||||||
|
DB_PASSWORD_5=root
|
||||||
|
|
||||||
|
DB_CONNECTION_7=mysql
|
||||||
|
DB_HOST_7=mysql
|
||||||
|
DB_PORT_7=3306
|
||||||
|
DB_DATABASE_7=master_erahn
|
||||||
|
DB_USERNAME_7=root
|
||||||
|
DB_PASSWORD_7=root
|
||||||
|
|
||||||
|
DB_CONNECTION_6=mysql
|
||||||
|
DB_HOST_6=mysql
|
||||||
|
DB_PORT_6=3306
|
||||||
|
DB_DATABASE_6=erahn_test
|
||||||
|
DB_USERNAME_6=root
|
||||||
|
DB_PASSWORD_6=root
|
||||||
|
|
||||||
|
# DB_CONNECTION_8=mysql
|
||||||
|
# DB_HOST_8=mysql
|
||||||
|
# DB_PORT_8=3306
|
||||||
|
# DB_DATABASE_8=arrahn_klanas
|
||||||
|
# DB_USERNAME_8=spider
|
||||||
|
# DB_PASSWORD_8=G0dz!ll42020
|
||||||
|
|
||||||
|
TENNANT_MASTER_DB=master_erahn
|
||||||
|
TENNANT_KAUNTER_DB=kaunter_erahn
|
||||||
|
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
name: Build Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- staging
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-backend:
|
||||||
|
runs-on: docker
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to Docker registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
|
||||||
|
docker login git.koppkb.com \
|
||||||
|
-u "${{ secrets.REGISTRY_USERNAME }}" \
|
||||||
|
--password-stdin
|
||||||
|
|
||||||
|
- name: Build & push backend image
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
IMAGE="git.koppkb.com/kopkb/api_arrahn"
|
||||||
|
TAGS="-t ${IMAGE}:${{ gitea.sha }}"
|
||||||
|
|
||||||
|
if [ "${{ gitea.ref_type }}" = "tag" ] && echo "${{ gitea.ref_name }}" | grep -q '^v'; then
|
||||||
|
TAGS="${TAGS} -t ${IMAGE}:${{ gitea.ref_name }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${{ gitea.ref_name }}" = "staging" ]; then
|
||||||
|
TAGS="${TAGS} -t ${IMAGE}:staging"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building and pushing backend: ${TAGS}"
|
||||||
|
docker buildx build \
|
||||||
|
--target staging \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
--cache-from type=registry,ref=${IMAGE}:buildcache,ignore-error=true \
|
||||||
|
--cache-to type=registry,ref=${IMAGE}:buildcache,mode=max \
|
||||||
|
-f docker/php/Dockerfile \
|
||||||
|
${TAGS} \
|
||||||
|
--push .
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
name: Deploy to Staging
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
image_tag:
|
||||||
|
description: "Docker image tag to deploy (commit SHA, staging, or v*)"
|
||||||
|
required: true
|
||||||
|
default: "staging"
|
||||||
|
type: string
|
||||||
|
|
||||||
|
env:
|
||||||
|
APP_IMAGE: git.koppkb.com/kopkb/api_arrahn
|
||||||
|
DEPLOY_DIR: /home/arrahn/Project/api_arrahn
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: host
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ inputs.image_tag }}
|
||||||
|
|
||||||
|
- name: Login to Docker registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
|
||||||
|
docker login git.koppkb.com \
|
||||||
|
-u "${{ secrets.REGISTRY_USERNAME }}" \
|
||||||
|
--password-stdin
|
||||||
|
|
||||||
|
- name: Verify image exists in registry
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
IMAGE_TAG="${{ inputs.image_tag }}"
|
||||||
|
IMAGE="${APP_IMAGE}:${IMAGE_TAG}"
|
||||||
|
|
||||||
|
echo "Checking if image exists: ${IMAGE}"
|
||||||
|
if ! docker manifest inspect "${IMAGE}" > /dev/null 2>&1; then
|
||||||
|
echo "ERROR: Image ${IMAGE} does not exist in registry!"
|
||||||
|
echo "Run the Build Docker Image workflow first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✓ ${IMAGE} found"
|
||||||
|
|
||||||
|
- name: Pull Docker image
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
IMAGE_TAG="${{ inputs.image_tag }}"
|
||||||
|
docker pull "${APP_IMAGE}:${IMAGE_TAG}"
|
||||||
|
echo "✓ Image pulled successfully"
|
||||||
|
|
||||||
|
- name: Sync compose file and deploy
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
IMAGE_TAG="${{ inputs.image_tag }}"
|
||||||
|
|
||||||
|
mkdir -p "${DEPLOY_DIR}/docker/nginx" "${DEPLOY_DIR}/docker/mysql"
|
||||||
|
cp docker-compose.staging.yml "${DEPLOY_DIR}/docker-compose.yml"
|
||||||
|
cp docker/nginx/default.conf "${DEPLOY_DIR}/docker/nginx/default.conf"
|
||||||
|
cp -R docker/mysql/init "${DEPLOY_DIR}/docker/mysql/"
|
||||||
|
|
||||||
|
if [ ! -f "${DEPLOY_DIR}/.env.staging" ]; then
|
||||||
|
if [ -f .env.staging ]; then
|
||||||
|
cp .env.staging "${DEPLOY_DIR}/.env.staging"
|
||||||
|
echo "Copied .env.staging from repo (first deploy). Edit ${DEPLOY_DIR}/.env.staging on the server if needed."
|
||||||
|
else
|
||||||
|
echo "ERROR: ${DEPLOY_DIR}/.env.staging is missing on the server"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "${DEPLOY_DIR}"
|
||||||
|
|
||||||
|
export APP_IMAGE
|
||||||
|
export IMAGE_TAG
|
||||||
|
|
||||||
|
docker compose --env-file .env.staging -f docker-compose.yml pull app
|
||||||
|
docker compose --env-file .env.staging -f docker-compose.yml up -d --no-build --remove-orphans
|
||||||
|
|
||||||
|
echo "✓ Deployed IMAGE_TAG=${IMAGE_TAG}"
|
||||||
|
|
||||||
|
- name: Verify deployment
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
cd "${DEPLOY_DIR}"
|
||||||
|
|
||||||
|
echo "Waiting for services to start..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
for SERVICE in app web mysql; do
|
||||||
|
STATUS=$(docker compose --env-file .env.staging -f docker-compose.yml ps --status running --format '{{.Name}}' "$SERVICE" 2>/dev/null || true)
|
||||||
|
if [ -z "$STATUS" ]; then
|
||||||
|
echo "ERROR: ${SERVICE} is not running"
|
||||||
|
docker compose --env-file .env.staging -f docker-compose.yml ps
|
||||||
|
docker compose --env-file .env.staging -f docker-compose.yml logs --tail=50 "$SERVICE" || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✓ ${SERVICE} is running (${STATUS})"
|
||||||
|
done
|
||||||
|
|
||||||
|
HTTP_PORT=$(grep -E '^HTTP_PORT=' .env.staging 2>/dev/null | cut -d= -f2- | tr -d '"' || true)
|
||||||
|
HTTP_PORT=${HTTP_PORT:-8090}
|
||||||
|
|
||||||
|
check_health() {
|
||||||
|
NAME=$1
|
||||||
|
URL=$2
|
||||||
|
for i in 1 2 3 4 5 6; do
|
||||||
|
if curl -sf "$URL" > /dev/null; then
|
||||||
|
echo "✓ ${NAME} health check passed (${URL})"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "Waiting for ${NAME}... attempt ${i}/6"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
echo "ERROR: ${NAME} health check failed (${URL})"
|
||||||
|
docker compose --env-file .env.staging -f docker-compose.yml logs --tail=50 app web || true
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
check_health "api" "http://127.0.0.1:${HTTP_PORT}/health"
|
||||||
@@ -30,6 +30,7 @@ use App\Status;
|
|||||||
use App\LookupStatus;
|
use App\LookupStatus;
|
||||||
use App\ARFiles;
|
use App\ARFiles;
|
||||||
use App\WTDDraft;
|
use App\WTDDraft;
|
||||||
|
use App\WTDSimulasi;
|
||||||
use App\SerahBaki;
|
use App\SerahBaki;
|
||||||
use App\WTD;
|
use App\WTD;
|
||||||
use App\StokAudit1;
|
use App\StokAudit1;
|
||||||
@@ -62,7 +63,6 @@ use Illuminate\Pagination\LengthAwarePaginator;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use App\Jobs\AccountCheckJob;
|
use App\Jobs\AccountCheckJob;
|
||||||
use App\Penyelarasan;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
@@ -2365,7 +2365,6 @@ class AdminPageController extends Controller
|
|||||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
||||||
|
|
||||||
//$latestbatch = SerahBaki::on($cawangan['mysql'])->where('norujukan','baru')->get()->toArray();
|
//$latestbatch = SerahBaki::on($cawangan['mysql'])->where('norujukan','baru')->get()->toArray();
|
||||||
|
|
||||||
//new added
|
//new added
|
||||||
$serahBaki = SerahBaki::on($cawangan['mysql'])
|
$serahBaki = SerahBaki::on($cawangan['mysql'])
|
||||||
->where('norujukan', 'baru')
|
->where('norujukan', 'baru')
|
||||||
@@ -2374,28 +2373,28 @@ class AdminPageController extends Controller
|
|||||||
$allBatchNo = $serahBaki->pluck('batchno')->unique()->toArray();
|
$allBatchNo = $serahBaki->pluck('batchno')->unique()->toArray();
|
||||||
|
|
||||||
$wtddraftData = WTDDraft::on('mysql7')
|
$wtddraftData = WTDDraft::on('mysql7')
|
||||||
->selectRaw("
|
->selectRaw("
|
||||||
batchno_serah,
|
batchno_serah,
|
||||||
YEAR(t_jual) as tahun,
|
YEAR(t_jual) as tahun,
|
||||||
GROUP_CONCAT(
|
GROUP_CONCAT(
|
||||||
DISTINCT MONTH(t_jual)
|
DISTINCT MONTH(t_jual)
|
||||||
ORDER BY MONTH(t_jual)
|
ORDER BY MONTH(t_jual)
|
||||||
SEPARATOR ','
|
SEPARATOR ','
|
||||||
) as bulan
|
) as bulan
|
||||||
")
|
")
|
||||||
->where('kodcaw', $request->kodcaw)
|
->where('kodcaw', $request->kodcaw)
|
||||||
->whereIn('batchno_serah', $allBatchNo)
|
->whereIn('batchno_serah', $allBatchNo)
|
||||||
->groupBy('batchno_serah', DB::raw('YEAR(t_jual)'))
|
->groupBy('batchno_serah', DB::raw('YEAR(t_jual)'))
|
||||||
->get()
|
->get()
|
||||||
->groupBy('batchno_serah')
|
->groupBy('batchno_serah')
|
||||||
->map(function ($rows) {
|
->map(function ($rows) {
|
||||||
return $rows->map(function ($row) {
|
return $rows->map(function ($row) {
|
||||||
return [
|
return [
|
||||||
'tahun' => $row->tahun,
|
'tahun' => $row->tahun,
|
||||||
'bulan' => $row->bulan
|
'bulan' => $row->bulan
|
||||||
];
|
];
|
||||||
})->values();
|
})->values();
|
||||||
});
|
});
|
||||||
|
|
||||||
$finalData = $serahBaki->map(function ($item) use ($wtddraftData) {
|
$finalData = $serahBaki->map(function ($item) use ($wtddraftData) {
|
||||||
$batchno = $item->batchno;
|
$batchno = $item->batchno;
|
||||||
@@ -2427,29 +2426,27 @@ class AdminPageController extends Controller
|
|||||||
|
|
||||||
$finalDataArray = $finalData->toArray();
|
$finalDataArray = $finalData->toArray();
|
||||||
//end new added
|
//end new added
|
||||||
|
|
||||||
$batch_old = WTDDraft::on('mysql7')->select('kodcaw')->where('batchno_serah',0)->where('kodcaw',$request->kodcaw)
|
$batch_old = WTDDraft::on('mysql7')->select('kodcaw')->where('batchno_serah',0)->where('kodcaw',$request->kodcaw)
|
||||||
->groupBy('kodcaw')->get();
|
->groupBy('kodcaw')->get();
|
||||||
|
|
||||||
$batch_old_noruj = WTDDraft::on('mysql7')->where('batchno_serah',0)->where('kodcaw',$request->kodcaw)->pluck('norujukan');
|
$batch_old_noruj = WTDDraft::on('mysql7')->where('batchno_serah',0)->where('kodcaw',$request->kodcaw)->pluck('norujukan');
|
||||||
$lelong_data = Lelong::on($cawangan['mysql'])->whereIn('norujukan',$batch_old_noruj)->get();
|
$lelong_data = Lelong::on($cawangan['mysql'])->whereIn('norujukan',$batch_old_noruj)->get();
|
||||||
|
|
||||||
foreach($batch_old as $index=>$bo)
|
foreach($batch_old as $index=>$bo)
|
||||||
{
|
{
|
||||||
//array_push($latestbatch,['recno' => 0,'norujukan' => 'lama','batchno' => 0,'baki' => $lelong_data->sum('baki'),'aktif' => 1]);
|
//array_push($latestbatch,['recno' => 0,'norujukan' => 'lama','batchno' => 0,'baki' => $lelong_data->sum('baki'),'aktif' => 1]);
|
||||||
array_push($finalDataArray,['recno' => 0,'norujukan' => 'lama','batchno' => 0,'baki' => $lelong_data->sum('baki'),'aktif' => 1]);
|
array_push($finalDataArray,['recno' => 0,'norujukan' => 'lama','batchno' => 0,'baki' => $lelong_data->sum('baki'),'aktif' => 1]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//$data = $this->paginate($latestbatch,8);
|
//$data = $this->paginate($latestbatch,8);
|
||||||
$data = $this->paginate($finalDataArray,8);
|
$data = $this->paginate($finalDataArray,8);
|
||||||
|
|
||||||
//dd($data);
|
|
||||||
|
|
||||||
return response()->json($data,200);
|
return response()->json($data,200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function rekodWTDByBatchNo($batchno,Request $request){
|
public function rekodWTDByBatchNo($batchno,Request $request){
|
||||||
|
|
||||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
||||||
@@ -2727,7 +2724,7 @@ class AdminPageController extends Controller
|
|||||||
'prkod' => "01",
|
'prkod' => "01",
|
||||||
'teller' => "DM",
|
'teller' => "DM",
|
||||||
'bakipjm' => ($lel['bakipjm']) ? $lel['bakipjm'] : 0,
|
'bakipjm' => ($lel['bakipjm']) ? $lel['bakipjm'] : 0,
|
||||||
'bakiupah' => ($lel['bakiupah']) ? $lel['bakiupah'] : 0,
|
'bakiupah' => $lel['bakiupah'],
|
||||||
'cajlain' => '0.00',
|
'cajlain' => '0.00',
|
||||||
'cajlelong' => $lel['cajlelong'],
|
'cajlelong' => $lel['cajlelong'],
|
||||||
'kodgl' => '',
|
'kodgl' => '',
|
||||||
@@ -2749,7 +2746,7 @@ class AdminPageController extends Controller
|
|||||||
't_jual' => $lel['t_jual'],
|
't_jual' => $lel['t_jual'],
|
||||||
'hargajual' => $lel['hargajual'],
|
'hargajual' => $lel['hargajual'],
|
||||||
'pinjaman' => $lel['pinjaman'],
|
'pinjaman' => $lel['pinjaman'],
|
||||||
'bakiupah' => ($lel['bakiupah']) ? $lel['bakiupah'] : 0,
|
'bakiupah' => $lel['bakiupah'],
|
||||||
'cajlelong' => $lel['cajlelong'],
|
'cajlelong' => $lel['cajlelong'],
|
||||||
'gst_cl' => $lel['gst_cl'],
|
'gst_cl' => $lel['gst_cl'],
|
||||||
'baki' => $lel['baki'],
|
'baki' => $lel['baki'],
|
||||||
@@ -2779,222 +2776,6 @@ class AdminPageController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function janaSimulasiWTD(Request $request)
|
|
||||||
{
|
|
||||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $request->kodcaw)->first();
|
|
||||||
|
|
||||||
//listing sag belum tuntut cwgn
|
|
||||||
$sag_cwgn = collect(
|
|
||||||
Lelong::on($cawangan['mysql'])
|
|
||||||
->selectRaw('norujukan')
|
|
||||||
->whereYear('t_jual', $request->tahun)
|
|
||||||
->whereNull('trkhtuntut')
|
|
||||||
->where('baki', '>', 0)
|
|
||||||
->pluck('norujukan') // lebih bersih
|
|
||||||
);
|
|
||||||
|
|
||||||
//listing sag blocked
|
|
||||||
$sag_online = collect(
|
|
||||||
WTDDraft::on('mysql7')
|
|
||||||
->selectRaw('norujukan')
|
|
||||||
->where('kodcaw', '=', $request->kodcaw)
|
|
||||||
->pluck('norujukan')
|
|
||||||
);
|
|
||||||
//dd($sag_online);
|
|
||||||
//filter sag yg tk wujud dlm wtd_draft
|
|
||||||
$filtersag = $sag_cwgn->diff($sag_online);
|
|
||||||
|
|
||||||
//query baru
|
|
||||||
$tarikh_belum_tuntut = Lelong::on($cawangan['mysql'])
|
|
||||||
->selectRaw('
|
|
||||||
MONTH(t_jual) as bulan,
|
|
||||||
SUM(pinjaman) as pembiayaan,
|
|
||||||
ABS(SUM(baki)) as baki,
|
|
||||||
COUNT(DISTINCT norujukan) as jumlah_norujukan,
|
|
||||||
kodcaw
|
|
||||||
')
|
|
||||||
->whereIn('norujukan', $filtersag)
|
|
||||||
->groupBy('bulan', 'kodcaw')
|
|
||||||
->orderBy('bulan')
|
|
||||||
->get();
|
|
||||||
|
|
||||||
$tarikh_belum_tuntut = $tarikh_belum_tuntut->map(function ($item) {
|
|
||||||
$item->bulan = \Carbon\Carbon::create()->month($item->bulan)->format('F');
|
|
||||||
return $item;
|
|
||||||
});
|
|
||||||
|
|
||||||
return response()->json($tarikh_belum_tuntut);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function RekodSimulasiWTD(Request $request)
|
|
||||||
{
|
|
||||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $request->kodcaw)->first();
|
|
||||||
|
|
||||||
$rekod_simulasi = Lelong::on($cawangan['mysql'])
|
|
||||||
->join('gadai','lelong.norujukan','=','gadai.norujukan')
|
|
||||||
->selectRaw('ABS(lelong.baki) as baki, lelong.t_lelong, lelong.pinjaman, lelong.norujukan, gadai.nokp')
|
|
||||||
->whereMonth('lelong.t_jual', $request->month)
|
|
||||||
->whereYear('lelong.t_jual', $request->year)
|
|
||||||
->whereNull('lelong.trkhtuntut')
|
|
||||||
->where('lelong.baki', '>', 0)
|
|
||||||
->get();
|
|
||||||
|
|
||||||
return response()->json($rekod_simulasi);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function prosesSimulasiWTD(Request $request)
|
|
||||||
{
|
|
||||||
$proses = $request->input;
|
|
||||||
|
|
||||||
// dd($proses, $cawangan);
|
|
||||||
|
|
||||||
$baki = 0;
|
|
||||||
$jumlahPembiayaan = 0;
|
|
||||||
$simulasi = WTDSimulasi::max('simulasi')+1;
|
|
||||||
|
|
||||||
foreach ($proses as $item) {
|
|
||||||
WTDSimulasi::create([
|
|
||||||
'bulan' => $item['bulan'],
|
|
||||||
'tahun' => $item['tahun'],
|
|
||||||
'kodcaw' => $item['kodcaw'],
|
|
||||||
'jumlah_sag' => $item['jumlah_sag'],
|
|
||||||
'pembiayaan'=> $item['pembiayaan'],
|
|
||||||
'baki'=> $item['baki'],
|
|
||||||
'simulasi' => $simulasi,
|
|
||||||
]);
|
|
||||||
$baki += $item['baki'];
|
|
||||||
$jumlahPembiayaan = $item['pembiayaan'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json(['status' => 'success','simulasi' => $simulasi,'baki' => $baki,'pinjaman' => $jumlahPembiayaan]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function pengesahanSimulasiWTD(Request $request)
|
|
||||||
{
|
|
||||||
// Decode the JSON records from the request
|
|
||||||
$records = json_decode($request->records, true);
|
|
||||||
|
|
||||||
// Retrieve and clean 'kodcaw' from the request
|
|
||||||
$kodcaw = $request->kodcaw;
|
|
||||||
$kodcaw_clean = str_replace('"', '', $kodcaw);
|
|
||||||
|
|
||||||
// Get the database connection for the branch (cawangan)
|
|
||||||
$cawangan = Cawangan::where('kodcaw', $kodcaw_clean)->first();
|
|
||||||
|
|
||||||
// Check if 'Cawangan' exists
|
|
||||||
if (!$cawangan) {
|
|
||||||
return response()->json(['status' => 'error', 'message' => 'Invalid branch code (kodcaw).'], 404);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cawangan_connection = $cawangan->mysql;
|
|
||||||
|
|
||||||
// Get the latest batch number and increment it
|
|
||||||
$latestBatch = SerahBaki::on($cawangan_connection)->max('batchno') + 1;
|
|
||||||
|
|
||||||
// Initialize total variables
|
|
||||||
$totalPembiayaan = 0;
|
|
||||||
$totalBaki = 0;
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Iterate through the records and save them to the WTDDraft table
|
|
||||||
foreach ($records as $record) {
|
|
||||||
// Check if 'bulan' and 'tahun' exist in the record
|
|
||||||
if (!isset($record['bulan']) || !isset($record['tahun'])) {
|
|
||||||
return response()->json(['status' => 'error', 'message' => 'Missing bulan or tahun in records.'], 400);
|
|
||||||
}
|
|
||||||
$month = DateTime::createFromFormat('F', $record["bulan"])->format('n');
|
|
||||||
|
|
||||||
|
|
||||||
// Query norujukan records from the database
|
|
||||||
$query_norujukan = Lelong::on($cawangan_connection)
|
|
||||||
->join('gadai', 'lelong.norujukan', '=', 'gadai.norujukan')
|
|
||||||
->selectRaw('ABS(lelong.baki) as baki, lelong.t_lelong, lelong.pinjaman, lelong.norujukan, gadai.nokp, lelong.t_jual')
|
|
||||||
->whereMonth('lelong.t_jual', $month)
|
|
||||||
->whereYear('lelong.t_jual', $record["tahun"])
|
|
||||||
->whereNull('lelong.trkhtuntut')
|
|
||||||
->where('lelong.baki', '>', 0)
|
|
||||||
->get();
|
|
||||||
|
|
||||||
// Save each record to the WTDDraft table
|
|
||||||
foreach ($query_norujukan as $query) {
|
|
||||||
$wtddraft = new WTDDraft();
|
|
||||||
$wtddraft->nokp = $query['nokp'];
|
|
||||||
$wtddraft->kodcaw = $kodcaw_clean;
|
|
||||||
$wtddraft->norujukan = $query['norujukan'];
|
|
||||||
$wtddraft->t_jual = $query['t_jual'];
|
|
||||||
$wtddraft->t_gadai = $query['t_gadai'] ?? null; // Optional: ensure 't_gadai' exists
|
|
||||||
$wtddraft->t_lelong = $query['t_lelong'];
|
|
||||||
$wtddraft->batchno_serah = $latestBatch;
|
|
||||||
$wtddraft->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Accumulate totals
|
|
||||||
$totalPembiayaan += $record['pembiayaan'] ?? 0;
|
|
||||||
$totalBaki += $record['baki'] ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new record in the SerahBaki table
|
|
||||||
SerahBaki::on($cawangan_connection)->create([
|
|
||||||
'norujukan' => 'baru',
|
|
||||||
'batchno' => $latestBatch,
|
|
||||||
'hargajual' => 0.00,
|
|
||||||
'pinjaman' => $totalPembiayaan,
|
|
||||||
'upah' => 0.00,
|
|
||||||
'cajlel' => 0.00,
|
|
||||||
'gst_cl' => 0.00,
|
|
||||||
'gst_hj' => 0.00,
|
|
||||||
'baki' => $totalBaki,
|
|
||||||
'tarikh' => Carbon::now()->toDateString(),
|
|
||||||
't_jual' => Carbon::now()->toDateString(),
|
|
||||||
'nopelanggan' => '',
|
|
||||||
'aktif' => 0,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Return a success response with the new batch number
|
|
||||||
return response()->json(['status' => 'success', 'batchno' => $latestBatch], 200);
|
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
// Log the error and return a failure response
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
Log::error($e->getLine());
|
|
||||||
return response()->json(['status' => 'error', 'message' => $e->getMessage()], 500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function simulasiToDraft(Request $request)
|
|
||||||
{
|
|
||||||
$bulan = $request->bulan;
|
|
||||||
|
|
||||||
if (!$bulan || count($bulan) === 0) {
|
|
||||||
return response()->json(['error' => 'Sila pilih sekurang-kurangnya satu bulan.'], 400);
|
|
||||||
}
|
|
||||||
|
|
||||||
$simulasi = WTDSimulasi::whereIn('bulan', $bulan)->get();
|
|
||||||
|
|
||||||
if ($simulasi->isEmpty()) {
|
|
||||||
return response()->json(['error' => 'Tiada data untuk bulan yang dipilih.'], 404);
|
|
||||||
}
|
|
||||||
|
|
||||||
// foreach ($simulasi as $data) {
|
|
||||||
// WTDDraft::create([
|
|
||||||
// 'nokp' => $data->nokp ?? null,
|
|
||||||
// 'kodcaw' => $data->kodcaw ?? null,
|
|
||||||
// 'norujukan' => $data->norujukan ?? null,
|
|
||||||
// 't_jual' => $data->t_jual ?? null,
|
|
||||||
// 't_gadai' => $data->t_gadai ?? null,
|
|
||||||
// 't_lelong' => $data->t_lelong ?? null,
|
|
||||||
// 'batchno_serah' => $data->simulasi, // Simpan sebagai rujukan
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
dd($bulan, $simulasi);
|
|
||||||
|
|
||||||
return response()->json(['message' => 'Data berjaya dipindahkan ke WTD Draft!']);
|
|
||||||
|
|
||||||
}
|
|
||||||
public function PenjanaanPC(Request $request){
|
public function PenjanaanPC(Request $request){
|
||||||
|
|
||||||
$timeloni = Carbon::now();
|
$timeloni = Carbon::now();
|
||||||
@@ -3445,8 +3226,6 @@ class AdminPageController extends Controller
|
|||||||
|
|
||||||
return response()->json($customers);
|
return response()->json($customers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function AkruKeuntunganSebenar(Request $request){
|
public function AkruKeuntunganSebenar(Request $request){
|
||||||
|
|
||||||
@@ -4045,13 +3824,13 @@ class AdminPageController extends Controller
|
|||||||
|
|
||||||
$get_imbangduga = imbangdugabackup::on($cawangan['mysql'])->where('tarikh', $lastDayOfYear)->first();
|
$get_imbangduga = imbangdugabackup::on($cawangan['mysql'])->where('tarikh', $lastDayOfYear)->first();
|
||||||
$get_imbangduga = optional($get_imbangduga)->toArray() ?? [];
|
$get_imbangduga = optional($get_imbangduga)->toArray() ?? [];
|
||||||
if(empty($get_imbangduga)){
|
// if(empty($get_imbangduga)){
|
||||||
$requestData = new Request([
|
// $requestData = new Request([
|
||||||
'tarikh' => $request->tarikh,
|
// 'tarikh' => $request->tarikh,
|
||||||
'kodcaw' => $kodcaw,
|
// 'kodcaw' => $kodcaw,
|
||||||
]);
|
// ]);
|
||||||
$exception_case = $this->AkruKeuntunganSebenar($requestData)->getData();
|
// $exception_case = $this->AkruKeuntunganSebenar($requestData);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$backdate_keun_sebenar += isset($get_imbangduga['keun_sebenar']) ? $get_imbangduga['keun_sebenar'] : 0;
|
$backdate_keun_sebenar += isset($get_imbangduga['keun_sebenar']) ? $get_imbangduga['keun_sebenar'] : 0;
|
||||||
$backdate_keun_sebenar += (float) ($exception_case ?? 0);
|
$backdate_keun_sebenar += (float) ($exception_case ?? 0);
|
||||||
@@ -4070,14 +3849,7 @@ class AdminPageController extends Controller
|
|||||||
$total = ($utgrugilama + $lelong + $upahsimpantebus + $upahsimpanlelong + $upahsimpanansur + $gstcajlelong + $keuntungansebenar + $upahsimpankeuntungansebelumtawarruq + $available_akru + $total_keuntungan_sebenar + $akru_ujrah + $akru_1percent) + $parameter;
|
$total = ($utgrugilama + $lelong + $upahsimpantebus + $upahsimpanlelong + $upahsimpanansur + $gstcajlelong + $keuntungansebenar + $upahsimpankeuntungansebelumtawarruq + $available_akru + $total_keuntungan_sebenar + $akru_ujrah + $akru_1percent) + $parameter;
|
||||||
|
|
||||||
if($kodcaw == '011229')
|
if($kodcaw == '011229')
|
||||||
$total -= 45390.37;
|
$total -= 45390.37;
|
||||||
|
|
||||||
if($kodcaw == 'KB2')
|
|
||||||
$total -= 64.8;
|
|
||||||
|
|
||||||
$total += Penyelarasan::on('mysql7')
|
|
||||||
->where('kodcaw', $kodcaw)
|
|
||||||
->sum(DB::raw('rugilelong + bakilelong + `lain-lain`'));
|
|
||||||
|
|
||||||
return response()->json($total,200);
|
return response()->json($total,200);
|
||||||
}
|
}
|
||||||
@@ -4250,4 +4022,222 @@ class AdminPageController extends Controller
|
|||||||
'result' => $status === 'completed' ? $result : null,
|
'result' => $status === 'completed' ? $result : null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//function wtd baru
|
||||||
|
public function janaSimulasiWTD(Request $request)
|
||||||
|
{
|
||||||
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $request->kodcaw)->first();
|
||||||
|
|
||||||
|
//listing sag belum tuntut cwgn
|
||||||
|
$sag_cwgn = collect(
|
||||||
|
Lelong::on($cawangan['mysql'])
|
||||||
|
->selectRaw('norujukan')
|
||||||
|
->whereYear('t_jual', $request->tahun)
|
||||||
|
->whereNull('trkhtuntut')
|
||||||
|
->where('baki', '>', 0)
|
||||||
|
->pluck('norujukan') // lebih bersih
|
||||||
|
);
|
||||||
|
|
||||||
|
//listing sag blocked
|
||||||
|
$sag_online = collect(
|
||||||
|
WTDDraft::on('mysql7')
|
||||||
|
->selectRaw('norujukan')
|
||||||
|
->where('kodcaw', '=', $request->kodcaw)
|
||||||
|
->pluck('norujukan')
|
||||||
|
);
|
||||||
|
//dd($sag_online);
|
||||||
|
//filter sag yg tk wujud dlm wtd_draft
|
||||||
|
$filtersag = $sag_cwgn->diff($sag_online);
|
||||||
|
|
||||||
|
//query baru
|
||||||
|
$tarikh_belum_tuntut = Lelong::on($cawangan['mysql'])
|
||||||
|
->selectRaw('
|
||||||
|
MONTH(t_jual) as bulan,
|
||||||
|
SUM(pinjaman) as pembiayaan,
|
||||||
|
ABS(SUM(baki)) as baki,
|
||||||
|
COUNT(DISTINCT norujukan) as jumlah_norujukan,
|
||||||
|
kodcaw
|
||||||
|
')
|
||||||
|
->whereIn('norujukan', $filtersag)
|
||||||
|
->groupBy('bulan', 'kodcaw')
|
||||||
|
->orderBy('bulan')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$tarikh_belum_tuntut = $tarikh_belum_tuntut->map(function ($item) {
|
||||||
|
$item->bulan = \Carbon\Carbon::create()->month($item->bulan)->format('F');
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
|
||||||
|
return response()->json($tarikh_belum_tuntut);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function RekodSimulasiWTD(Request $request)
|
||||||
|
{
|
||||||
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $request->kodcaw)->first();
|
||||||
|
|
||||||
|
$rekod_simulasi = Lelong::on($cawangan['mysql'])
|
||||||
|
->join('gadai','lelong.norujukan','=','gadai.norujukan')
|
||||||
|
->selectRaw('ABS(lelong.baki) as baki, lelong.t_lelong, lelong.pinjaman, lelong.norujukan, gadai.nokp')
|
||||||
|
->whereMonth('lelong.t_jual', $request->month)
|
||||||
|
->whereYear('lelong.t_jual', $request->year)
|
||||||
|
->whereNull('lelong.trkhtuntut')
|
||||||
|
->where('lelong.baki', '>', 0)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return response()->json($rekod_simulasi);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prosesSimulasiWTD(Request $request)
|
||||||
|
{
|
||||||
|
$proses = $request->input;
|
||||||
|
|
||||||
|
// dd($proses, $cawangan);
|
||||||
|
|
||||||
|
$baki = 0;
|
||||||
|
$jumlahPembiayaan = 0;
|
||||||
|
$simulasi = WTDSimulasi::max('simulasi')+1;
|
||||||
|
|
||||||
|
foreach ($proses as $item) {
|
||||||
|
WTDSimulasi::create([
|
||||||
|
'bulan' => $item['bulan'],
|
||||||
|
'tahun' => $item['tahun'],
|
||||||
|
'kodcaw' => $item['kodcaw'],
|
||||||
|
'jumlah_sag' => $item['jumlah_sag'],
|
||||||
|
'pembiayaan'=> $item['pembiayaan'],
|
||||||
|
'baki'=> $item['baki'],
|
||||||
|
'simulasi' => $simulasi,
|
||||||
|
]);
|
||||||
|
$baki += $item['baki'];
|
||||||
|
$jumlahPembiayaan = $item['pembiayaan'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => 'success','simulasi' => $simulasi,'baki' => $baki,'pinjaman' => $jumlahPembiayaan]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pengesahanSimulasiWTD(Request $request)
|
||||||
|
{
|
||||||
|
// Decode the JSON records from the request
|
||||||
|
$records = json_decode($request->records, true);
|
||||||
|
|
||||||
|
// Retrieve and clean 'kodcaw' from the request
|
||||||
|
$kodcaw = $request->kodcaw;
|
||||||
|
$kodcaw_clean = str_replace('"', '', $kodcaw);
|
||||||
|
|
||||||
|
// Get the database connection for the branch (cawangan)
|
||||||
|
$cawangan = Cawangan::where('kodcaw', $kodcaw_clean)->first();
|
||||||
|
|
||||||
|
// Check if 'Cawangan' exists
|
||||||
|
if (!$cawangan) {
|
||||||
|
return response()->json(['status' => 'error', 'message' => 'Invalid branch code (kodcaw).'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cawangan_connection = $cawangan->mysql;
|
||||||
|
|
||||||
|
// Get the latest batch number and increment it
|
||||||
|
$latestBatch = SerahBaki::on($cawangan_connection)->max('batchno') + 1;
|
||||||
|
|
||||||
|
// Initialize total variables
|
||||||
|
$totalPembiayaan = 0;
|
||||||
|
$totalBaki = 0;
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Iterate through the records and save them to the WTDDraft table
|
||||||
|
foreach ($records as $record) {
|
||||||
|
// Check if 'bulan' and 'tahun' exist in the record
|
||||||
|
if (!isset($record['bulan']) || !isset($record['tahun'])) {
|
||||||
|
return response()->json(['status' => 'error', 'message' => 'Missing bulan or tahun in records.'], 400);
|
||||||
|
}
|
||||||
|
$month = DateTime::createFromFormat('F', $record["bulan"])->format('n');
|
||||||
|
|
||||||
|
|
||||||
|
// Query norujukan records from the database
|
||||||
|
$query_norujukan = Lelong::on($cawangan_connection)
|
||||||
|
->join('gadai', 'lelong.norujukan', '=', 'gadai.norujukan')
|
||||||
|
->selectRaw('ABS(lelong.baki) as baki, lelong.t_lelong, lelong.pinjaman, lelong.norujukan, gadai.nokp, lelong.t_jual')
|
||||||
|
->whereMonth('lelong.t_jual', $month)
|
||||||
|
->whereYear('lelong.t_jual', $record["tahun"])
|
||||||
|
->whereNull('lelong.trkhtuntut')
|
||||||
|
->where('lelong.baki', '>', 0)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// Save each record to the WTDDraft table
|
||||||
|
foreach ($query_norujukan as $query) {
|
||||||
|
$wtddraft = new WTDDraft();
|
||||||
|
$wtddraft->nokp = $query['nokp'];
|
||||||
|
$wtddraft->kodcaw = $kodcaw_clean;
|
||||||
|
$wtddraft->norujukan = $query['norujukan'];
|
||||||
|
$wtddraft->t_jual = $query['t_jual'];
|
||||||
|
$wtddraft->t_gadai = $query['t_gadai'] ?? null; // Optional: ensure 't_gadai' exists
|
||||||
|
$wtddraft->t_lelong = $query['t_lelong'];
|
||||||
|
$wtddraft->batchno_serah = $latestBatch;
|
||||||
|
$wtddraft->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Accumulate totals
|
||||||
|
$totalPembiayaan += $record['pembiayaan'] ?? 0;
|
||||||
|
$totalBaki += $record['baki'] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new record in the SerahBaki table
|
||||||
|
SerahBaki::on($cawangan_connection)->create([
|
||||||
|
'norujukan' => 'baru',
|
||||||
|
'batchno' => $latestBatch,
|
||||||
|
'hargajual' => 0.00,
|
||||||
|
'pinjaman' => $totalPembiayaan,
|
||||||
|
'upah' => 0.00,
|
||||||
|
'cajlel' => 0.00,
|
||||||
|
'gst_cl' => 0.00,
|
||||||
|
'gst_hj' => 0.00,
|
||||||
|
'baki' => $totalBaki,
|
||||||
|
'tarikh' => Carbon::now()->toDateString(),
|
||||||
|
't_jual' => Carbon::now()->toDateString(),
|
||||||
|
'nopelanggan' => '',
|
||||||
|
'aktif' => 0,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Return a success response with the new batch number
|
||||||
|
return response()->json(['status' => 'success', 'batchno' => $latestBatch], 200);
|
||||||
|
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
// Log the error and return a failure response
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
Log::error($e->getLine());
|
||||||
|
return response()->json(['status' => 'error', 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function simulasiToDraft(Request $request)
|
||||||
|
{
|
||||||
|
$bulan = $request->bulan;
|
||||||
|
|
||||||
|
if (!$bulan || count($bulan) === 0) {
|
||||||
|
return response()->json(['error' => 'Sila pilih sekurang-kurangnya satu bulan.'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$simulasi = WTDSimulasi::whereIn('bulan', $bulan)->get();
|
||||||
|
|
||||||
|
if ($simulasi->isEmpty()) {
|
||||||
|
return response()->json(['error' => 'Tiada data untuk bulan yang dipilih.'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
// foreach ($simulasi as $data) {
|
||||||
|
// WTDDraft::create([
|
||||||
|
// 'nokp' => $data->nokp ?? null,
|
||||||
|
// 'kodcaw' => $data->kodcaw ?? null,
|
||||||
|
// 'norujukan' => $data->norujukan ?? null,
|
||||||
|
// 't_jual' => $data->t_jual ?? null,
|
||||||
|
// 't_gadai' => $data->t_gadai ?? null,
|
||||||
|
// 't_lelong' => $data->t_lelong ?? null,
|
||||||
|
// 'batchno_serah' => $data->simulasi, // Simpan sebagai rujukan
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
//dd($bulan, $simulasi);
|
||||||
|
|
||||||
|
return response()->json(['message' => 'Data berjaya dipindahkan ke WTD Draft!']);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -396,6 +396,7 @@ class CustomerController extends Controller
|
|||||||
// 'nota_arcc'=>$request->nota_arcc,
|
// 'nota_arcc'=>$request->nota_arcc,
|
||||||
'telefon' => $request->telefon1,
|
'telefon' => $request->telefon1,
|
||||||
'telefon2' => $request->telefon2,
|
'telefon2' => $request->telefon2,
|
||||||
|
'telefon2' => $request->telefon2,
|
||||||
));
|
));
|
||||||
|
|
||||||
return response()->json($customer_update, 200);
|
return response()->json($customer_update, 200);
|
||||||
@@ -420,6 +421,33 @@ class CustomerController extends Controller
|
|||||||
$customer->tag_anggota = 1;
|
$customer->tag_anggota = 1;
|
||||||
$customer->save();
|
$customer->save();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true,
|
||||||
|
'message' => 'Tag anggota berjaya dikemaskini.',
|
||||||
|
'data' => $customer
|
||||||
|
], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function assignAnggota($noic, Request $request)
|
||||||
|
{
|
||||||
|
// Semak sama ada pelanggan wujud
|
||||||
|
$customer = Customer::on('mysql7')
|
||||||
|
->where('kpbaru', $noic)
|
||||||
|
->orWhere('kplama', $noic)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$customer) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Pelanggan tidak dijumpai.'
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kemaskini tag_anggota
|
||||||
|
$customer->tag_anggota = 1;
|
||||||
|
$customer->save();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'message' => 'Tag anggota berjaya dikemaskini.',
|
'message' => 'Tag anggota berjaya dikemaskini.',
|
||||||
@@ -861,6 +889,14 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function anggotaKoperasi(Request $request){
|
||||||
|
|
||||||
|
$anggota = Anggota::where('noic',$request->noic)->first();
|
||||||
|
|
||||||
|
return response()->json($anggota);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function showCustomerByEachCawangan($ic)
|
public function showCustomerByEachCawangan($ic)
|
||||||
{
|
{
|
||||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||||
@@ -1102,4 +1138,41 @@ public function AdminsearchCustomerBySAG(Request $request)
|
|||||||
return response()->json($results);
|
return response()->json($results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateTagPdpa(Request $request)
|
||||||
|
{
|
||||||
|
$tarikh_cetak_pdpa = Carbon::now()->toDateString();
|
||||||
|
|
||||||
|
$no_ic = $request->input('no_ic');
|
||||||
|
|
||||||
|
$customer = Customer::where('kplama', $no_ic)
|
||||||
|
->orWhere('kpbaru', $no_ic)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$customer) {
|
||||||
|
return response()->json(['error' => 'Customer not found.'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$customer->tag_pdpa = $request->input('tag_pdpa');
|
||||||
|
$customer->tarikh_cetak_pdpa = $tarikh_cetak_pdpa;
|
||||||
|
$customer->save();
|
||||||
|
|
||||||
|
return response()->json(['message' => 'Customer PDPA updated successfully.'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function createNotaArcc($kodcaw, Request $request)
|
||||||
|
// {
|
||||||
|
// $current = Carbon::now();
|
||||||
|
|
||||||
|
// $customer = Customer::on('mysql7')->create([
|
||||||
|
// 'kodcaw' => $kodcaw,
|
||||||
|
// 'tarikhdaftar' => $current->toDateString(),
|
||||||
|
// 'nota_arcc' => $request->nota_arcc,
|
||||||
|
// 'teller' => $request->teller,
|
||||||
|
// 'aktif' => 'A'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// return response()->json($customer, 201);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -847,7 +847,7 @@ $date = new Carbon($request->tarikh);
|
|||||||
$bilangan_tebus = $tebus->count();
|
$bilangan_tebus = $tebus->count();
|
||||||
// $bilangan_ansuran = $ansuran->count();
|
// $bilangan_ansuran = $ansuran->count();
|
||||||
//$bilangan_customer_baru = Customer::on($cawangan['mysql'])->where([['tarikhdaftar','>=',$request->mula],['tarikhdaftar','<=',$request->akhir]])->count();
|
//$bilangan_customer_baru = Customer::on($cawangan['mysql'])->where([['tarikhdaftar','>=',$request->mula],['tarikhdaftar','<=',$request->akhir]])->count();
|
||||||
$bilangan_customer_baru = Customer::on('mysql7')->where([['tarikhdaftar','>=',$request->mula],['tarikhdaftar','<=',$request->akhir]])->count();
|
$bilangan_customer_baru = Customer::on('mysql7')->whereBetween('tarikhdaftar', [$request->mula, $request->akhir])->where('kodcaw', $request->kodcaw)->count();
|
||||||
|
|
||||||
//f
|
//f
|
||||||
$data_lelong = Lelong::on($cawangan['mysql'])->where([['t_jual','>=',$request->mula],['t_jual','<=',$request->akhir]])->get();
|
$data_lelong = Lelong::on($cawangan['mysql'])->where([['t_jual','>=',$request->mula],['t_jual','<=',$request->akhir]])->get();
|
||||||
@@ -975,23 +975,11 @@ $date = new Carbon($request->tarikh);
|
|||||||
|
|
||||||
$gadaiDataKaunter = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$total_keuntunganansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan');
|
$gadaiDataKaunter = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$total_keuntunganansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan');
|
||||||
|
|
||||||
// $keuntunganansuran_kaunter_query = TransaksiKeuntungan::on('mysql7')
|
|
||||||
// ->whereIn('norujukan',$gadaiDataKaunter)
|
|
||||||
// ->whereDate('tarikh_bayaran','>=',$request->mula)
|
|
||||||
// ->whereDate('tarikh_bayaran','<=',$request->akhir);
|
|
||||||
// //new update
|
|
||||||
$keuntunganansuran_kaunter_query = TransaksiKeuntungan::on('mysql7')
|
$keuntunganansuran_kaunter_query = TransaksiKeuntungan::on('mysql7')
|
||||||
->leftJoin('transaction as trans', function($join)
|
->whereIn('norujukan',$gadaiDataKaunter)
|
||||||
{
|
->whereDate('tarikh_bayaran','>=',$request->mula)
|
||||||
$join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan');
|
->whereDate('tarikh_bayaran','<=',$request->akhir);
|
||||||
$join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at');
|
|
||||||
})
|
|
||||||
->whereDate('trans.created_at','>=',$request->mula)
|
|
||||||
->whereDate('trans.created_at','<=',$request->akhir)
|
|
||||||
->where('trans.teller','<>','Online')
|
|
||||||
->where('trans.trans_type','=','A')
|
|
||||||
->where('trans.kodcaw',$request->kodcaw)
|
|
||||||
->pluck('transaksi_keuntungan.norujukan');
|
|
||||||
|
|
||||||
|
|
||||||
$total_keuntunganansuran_kaunter = $keuntunganansuran_kaunter_query->sum('bayaran_keuntungan');
|
$total_keuntunganansuran_kaunter = $keuntunganansuran_kaunter_query->sum('bayaran_keuntungan');
|
||||||
@@ -1257,7 +1245,7 @@ $date = new Carbon($request->tarikh);
|
|||||||
array_push($atarray,[
|
array_push($atarray,[
|
||||||
'tarikh' => $tarikh,
|
'tarikh' => $tarikh,
|
||||||
'masa' => $masa,
|
'masa' => $masa,
|
||||||
'users' => isset($at['users']) && $at['users'] !== '' ? $at['users'] : '-',
|
'users' => $at['users'],
|
||||||
'pelulus' => isset($atnewdata['namapelulus']) ? $atnewdata['namapelulus'] : '-',
|
'pelulus' => isset($atnewdata['namapelulus']) ? $atnewdata['namapelulus'] : '-',
|
||||||
'actions' => $at['actions'],
|
'actions' => $at['actions'],
|
||||||
'norujukan' => $at['norujukan'],
|
'norujukan' => $at['norujukan'],
|
||||||
|
|||||||
@@ -203,7 +203,10 @@ class MarhunController extends Controller
|
|||||||
$marhun = Marhun::on($cawangan['mysql'])
|
$marhun = Marhun::on($cawangan['mysql'])
|
||||||
->select('marhun.norujukan','gadai.nokp','customer.nama','marhun.marhun','marhun.nota','marhun.berat','marhun.karat','marhun.harga','marhun.n_marhun','marhun.t_gadai','marhun.tag_permata', 'marhun.berat_batu_permata')
|
->select('marhun.norujukan','gadai.nokp','customer.nama','marhun.marhun','marhun.nota','marhun.berat','marhun.karat','marhun.harga','marhun.n_marhun','marhun.t_gadai','marhun.tag_permata', 'marhun.berat_batu_permata')
|
||||||
->rightJoin('gadai', 'gadai.norujukan', '=', 'marhun.norujukan')
|
->rightJoin('gadai', 'gadai.norujukan', '=', 'marhun.norujukan')
|
||||||
->rightJoin(config('tennant_database.master_db') . '.customer as customer', 'customer.kpbaru','=','gadai.nokp')
|
->rightJoin('master_erahn.customer as customer', function($join) {
|
||||||
|
$join->on('customer.kpbaru', '=', 'gadai.nokp')
|
||||||
|
->orOn('customer.kplama', '=', 'gadai.nokp');
|
||||||
|
})
|
||||||
->where('marhun.t_gadai','=',$tarikh)
|
->where('marhun.t_gadai','=',$tarikh)
|
||||||
->orderBy('marhun.t_gadai')
|
->orderBy('marhun.t_gadai')
|
||||||
->get();
|
->get();
|
||||||
@@ -221,7 +224,10 @@ class MarhunController extends Controller
|
|||||||
$marhun = Marhun::on($cawangan['mysql'])
|
$marhun = Marhun::on($cawangan['mysql'])
|
||||||
->select('marhun.norujukan','gadai.sttebus','gadai.pinjaman','gadai.nokp','customer.nama','marhun.marhun','marhun.nota','marhun.berat','marhun.karat','marhun.harga','marhun.n_marhun','marhun.t_gadai')
|
->select('marhun.norujukan','gadai.sttebus','gadai.pinjaman','gadai.nokp','customer.nama','marhun.marhun','marhun.nota','marhun.berat','marhun.karat','marhun.harga','marhun.n_marhun','marhun.t_gadai')
|
||||||
->rightJoin('gadai', 'gadai.norujukan', '=', 'marhun.norujukan')
|
->rightJoin('gadai', 'gadai.norujukan', '=', 'marhun.norujukan')
|
||||||
->rightJoin(config('tennant_database.master_db') . '.customer as customer', 'customer.kpbaru','=','gadai.nokp')
|
->rightJoin('master_erahn.customer as customer', function($join) {
|
||||||
|
$join->on('customer.kpbaru', '=', 'gadai.nokp')
|
||||||
|
->orOn('customer.kplama', '=', 'gadai.nokp');
|
||||||
|
})
|
||||||
->where('marhun.t_gadai','<=',$tarikh)
|
->where('marhun.t_gadai','<=',$tarikh)
|
||||||
->whereYear('marhun.t_gadai','=',$current->year)
|
->whereYear('marhun.t_gadai','=',$current->year)
|
||||||
->where('gadai.sttebus','=','')
|
->where('gadai.sttebus','=','')
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class GadaianController extends Controller
|
|||||||
$summary_gadaian_data = array_map(function ($db_connection) use ($request) {
|
$summary_gadaian_data = array_map(function ($db_connection) use ($request) {
|
||||||
$query = Gadai::on($db_connection);
|
$query = Gadai::on($db_connection);
|
||||||
|
|
||||||
$query->select(DB::raw('count(norujukan) as total_gadaian, sum(berat) as sum_berat, sum(nilaimarhun) as sum_nilai_marhun, sum(pinjaman) as sum_pinjaman'));
|
$query->select(DB::raw('count(norujukan) as total_gadaian, sum(berat) as sum_berat, sum(nilaimarhun) as sum_nilai_marhun, sum(pinjaman) as sum_pinjaman, sum(upah12) as sum_upah_12'));
|
||||||
|
|
||||||
$query->when($request->filled('startDate') and $request->filled('endDate'), function ($q) use ($request) {
|
$query->when($request->filled('startDate') and $request->filled('endDate'), function ($q) use ($request) {
|
||||||
return $q->where('t_gadai', '>=', $request->startDate)
|
return $q->where('t_gadai', '>=', $request->startDate)
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
/cache
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# Staging stack — isolated from local docker-compose.yml (8080 / 3306)
|
||||||
|
# and from other apps on the server (unique project name + host ports).
|
||||||
|
#
|
||||||
|
# Local:
|
||||||
|
# docker compose --env-file .env.staging -f docker-compose.staging.yml up -d --build
|
||||||
|
#
|
||||||
|
# CI (image already in registry):
|
||||||
|
# APP_IMAGE=git.koppkb.com/KoPKB/api_arrahn IMAGE_TAG=<sha> \
|
||||||
|
# docker compose --env-file .env.staging -f docker-compose.staging.yml up -d --no-build
|
||||||
|
#
|
||||||
|
# Host nginx reverse-proxies the public domain to 127.0.0.1:${HTTP_PORT}.
|
||||||
|
# See docker/nginx/host-proxy.example.conf
|
||||||
|
#
|
||||||
|
# If 8090 or 3308 is already taken, set HTTP_PORT / MYSQL_PUBLISH_PORT in .env.staging.
|
||||||
|
|
||||||
|
name: api_arrahn_staging
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: ${APP_IMAGE:-api_arrahn}:${IMAGE_TAG:-staging}
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/php/Dockerfile
|
||||||
|
target: staging
|
||||||
|
container_name: api_arrahn_staging_app
|
||||||
|
working_dir: /var/www/html
|
||||||
|
volumes:
|
||||||
|
- storage_staging:/var/www/html/storage
|
||||||
|
- ./.env.staging:/var/www/html/.env.staging:ro
|
||||||
|
env_file:
|
||||||
|
- .env.staging
|
||||||
|
environment:
|
||||||
|
APP_ENV: staging
|
||||||
|
USE_STAGING_ENV: "true"
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
depends_on:
|
||||||
|
mysql:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
web:
|
||||||
|
image: nginx:1.25-alpine
|
||||||
|
container_name: api_arrahn_staging_web
|
||||||
|
ports:
|
||||||
|
- "${HTTP_PORT:-8090}:80"
|
||||||
|
volumes:
|
||||||
|
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.0
|
||||||
|
container_name: api_arrahn_staging_mysql
|
||||||
|
command: --default-authentication-plugin=mysql_native_password
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:${MYSQL_PUBLISH_PORT:-3308}:3306"
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: erahn_xtra
|
||||||
|
MYSQL_USER: xtrauser
|
||||||
|
MYSQL_PASSWORD: password
|
||||||
|
MYSQL_ROOT_PASSWORD: root
|
||||||
|
volumes:
|
||||||
|
- mysql_staging_data:/var/lib/mysql
|
||||||
|
- ./docker/mysql/init:/docker-entrypoint-initdb.d:ro
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uroot", "-proot"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 30
|
||||||
|
start_period: 20s
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mysql_staging_data:
|
||||||
|
storage_staging:
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/php/Dockerfile
|
||||||
|
target: development
|
||||||
|
working_dir: /var/www/html
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www/html:cached
|
||||||
|
environment:
|
||||||
|
APP_ENV: local
|
||||||
|
APP_DEBUG: "true"
|
||||||
|
depends_on:
|
||||||
|
- mysql
|
||||||
|
|
||||||
|
web:
|
||||||
|
image: nginx:1.25-alpine
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www/html:cached
|
||||||
|
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.0
|
||||||
|
command: --default-authentication-plugin=mysql_native_password
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: erahn_xtra
|
||||||
|
MYSQL_USER: xtrauser
|
||||||
|
MYSQL_PASSWORD: password
|
||||||
|
MYSQL_ROOT_PASSWORD: root
|
||||||
|
volumes:
|
||||||
|
- mysql_data:/var/lib/mysql
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mysql_data:
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
CREATE DATABASE IF NOT EXISTS master_erahn;
|
||||||
|
CREATE DATABASE IF NOT EXISTS kaunter_erahn;
|
||||||
|
|
||||||
|
GRANT ALL PRIVILEGES ON master_erahn.* TO 'xtrauser'@'%';
|
||||||
|
GRANT ALL PRIVILEGES ON kaunter_erahn.* TO 'xtrauser'@'%';
|
||||||
|
GRANT ALL PRIVILEGES ON erahn_xtra.* TO 'xtrauser'@'%';
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /var/www/html/public;
|
||||||
|
index index.php index.html;
|
||||||
|
|
||||||
|
charset utf-8;
|
||||||
|
client_max_body_size 50M;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ @php;
|
||||||
|
}
|
||||||
|
|
||||||
|
location @php {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME /var/www/html/public/index.php;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
fastcgi_pass app:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_read_timeout 120s;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
fastcgi_pass app:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_read_timeout 120s;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.(?!well-known).* {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
FROM php:7.4-fpm AS base
|
||||||
|
|
||||||
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
git \
|
||||||
|
pkg-config \
|
||||||
|
unzip \
|
||||||
|
libonig-dev \
|
||||||
|
libzip-dev \
|
||||||
|
libpng-dev \
|
||||||
|
libjpeg62-turbo-dev \
|
||||||
|
libfreetype6-dev \
|
||||||
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||||
|
&& docker-php-ext-install -j"$(nproc)" \
|
||||||
|
pdo_mysql \
|
||||||
|
mbstring \
|
||||||
|
bcmath \
|
||||||
|
zip \
|
||||||
|
exif \
|
||||||
|
gd \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||||
|
|
||||||
|
COPY docker/php/php.ini /usr/local/etc/php/conf.d/app.ini
|
||||||
|
COPY docker/php/zz-clear-env.conf /usr/local/etc/php-fpm.d/zz-clear-env.conf
|
||||||
|
COPY docker/php/entrypoint.sh /usr/local/bin/app-entrypoint.sh
|
||||||
|
|
||||||
|
RUN chmod +x /usr/local/bin/app-entrypoint.sh \
|
||||||
|
&& usermod -u 1000 www-data && groupmod -g 1000 www-data
|
||||||
|
|
||||||
|
ENTRYPOINT ["app-entrypoint.sh"]
|
||||||
|
CMD ["php-fpm"]
|
||||||
|
|
||||||
|
FROM base AS staging
|
||||||
|
|
||||||
|
COPY --chown=www-data:www-data . /var/www/html
|
||||||
|
|
||||||
|
RUN composer install --no-interaction --prefer-dist --no-dev --optimize-autoloader \
|
||||||
|
&& mkdir -p \
|
||||||
|
storage/logs \
|
||||||
|
storage/framework/cache/data \
|
||||||
|
storage/framework/views \
|
||||||
|
storage/framework/sessions \
|
||||||
|
storage/app/public \
|
||||||
|
bootstrap/cache \
|
||||||
|
&& chown -R www-data:www-data storage bootstrap/cache vendor
|
||||||
|
|
||||||
|
FROM base AS development
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd /var/www/html
|
||||||
|
|
||||||
|
if [ "${USE_STAGING_ENV:-false}" = "true" ] && [ -f .env.staging ]; then
|
||||||
|
cp .env.staging .env
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f composer.json ]; then
|
||||||
|
if [ -f vendor/autoload.php ] && [ "${USE_STAGING_ENV:-false}" = "true" ]; then
|
||||||
|
: # vendor is baked into the staging image
|
||||||
|
elif [ "${USE_STAGING_ENV:-false}" = "true" ]; then
|
||||||
|
composer install --no-interaction --prefer-dist --no-dev --optimize-autoloader
|
||||||
|
else
|
||||||
|
composer install --no-interaction --prefer-dist
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p \
|
||||||
|
storage/logs \
|
||||||
|
storage/framework/cache/data \
|
||||||
|
storage/framework/views \
|
||||||
|
storage/framework/sessions \
|
||||||
|
storage/app/public \
|
||||||
|
bootstrap/cache
|
||||||
|
|
||||||
|
chown -R www-data:www-data storage bootstrap/cache
|
||||||
|
|
||||||
|
exec docker-php-entrypoint "$@"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
memory_limit=512M
|
||||||
|
upload_max_filesize=50M
|
||||||
|
post_max_size=50M
|
||||||
|
max_execution_time=120
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[www]
|
||||||
|
; Pass container env vars (from compose env_file) through to PHP workers.
|
||||||
|
clear_env = no
|
||||||
@@ -21,6 +21,10 @@ use App\Http\Controllers\TransactionOnlineTrailController;
|
|||||||
use App\Http\Controllers\Reports\RingkasanHarianController;
|
use App\Http\Controllers\Reports\RingkasanHarianController;
|
||||||
use App\Transaction;
|
use App\Transaction;
|
||||||
|
|
||||||
|
$router->get('/health', function () {
|
||||||
|
return response()->json(['status' => 'ok']);
|
||||||
|
});
|
||||||
|
|
||||||
$router->group(['namespace' => '\Rap2hpoutre\LaravelLogViewer'], function() use ($router) {
|
$router->group(['namespace' => '\Rap2hpoutre\LaravelLogViewer'], function() use ($router) {
|
||||||
$router->get('logs', 'LogViewerController@index');
|
$router->get('logs', 'LogViewerController@index');
|
||||||
});
|
});
|
||||||
@@ -62,6 +66,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
|||||||
$router->get('customer/anggota',['uses'=>'CustomerController@anggotaKoperasi']);
|
$router->get('customer/anggota',['uses'=>'CustomerController@anggotaKoperasi']);
|
||||||
$router->get('customer/eachcawangan/{ic}',['uses'=>'CustomerController@showCustomerByEachCawangan']);
|
$router->get('customer/eachcawangan/{ic}',['uses'=>'CustomerController@showCustomerByEachCawangan']);
|
||||||
$router->put('customers/{noic}/assign-anggota', ['uses' => 'CustomerController@assignAnggota']);
|
$router->put('customers/{noic}/assign-anggota', ['uses' => 'CustomerController@assignAnggota']);
|
||||||
|
$router->post('/customers/update-tag-pdpa', ['uses' => 'CustomerController@updateTagPdpa']);
|
||||||
|
|
||||||
//arcc
|
//arcc
|
||||||
$router->get('customer/searchbyname',['uses'=>'CustomerController@searchByName']);
|
$router->get('customer/searchbyname',['uses'=>'CustomerController@searchByName']);
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/debugbar
|
||||||
|
/framework/sessions
|
||||||
Reference in New Issue
Block a user