Compare commits
3 Commits
0aa7d22094
...
5b235def37
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b235def37 | ||
|
|
593a4f0d9c | ||
|
|
d4e6a3d73d |
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Modules\Webstatement\Models\Account;
|
||||||
use Modules\Webstatement\Models\ProvinceCore;
|
use Modules\Webstatement\Models\ProvinceCore;
|
||||||
|
|
||||||
if(!function_exists('calculatePeriodDates')) {
|
if(!function_exists('calculatePeriodDates')) {
|
||||||
@@ -41,7 +43,54 @@ use Modules\Webstatement\Models\ProvinceCore;
|
|||||||
|
|
||||||
if(!function_exists('getProvinceCoreName')){
|
if(!function_exists('getProvinceCoreName')){
|
||||||
function getProvinceCoreName($code){
|
function getProvinceCoreName($code){
|
||||||
$province = ProvinceCore::where('code',$code)->first();
|
return $code;
|
||||||
return $province->name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!function_exists('generatePassword')){
|
||||||
|
function generatePassword(Account $account)
|
||||||
|
{
|
||||||
|
$customer = $account->customer;
|
||||||
|
$accountNumber = $account->account_number;
|
||||||
|
|
||||||
|
// Get last 2 digits of account number
|
||||||
|
$lastTwoDigits = substr($accountNumber, -2);
|
||||||
|
|
||||||
|
// Determine which date to use based on sector
|
||||||
|
$dateToUse = null;
|
||||||
|
|
||||||
|
if ($customer && $customer->sector) {
|
||||||
|
$firstDigitSector = substr($customer->sector, 0, 1);
|
||||||
|
|
||||||
|
if ($firstDigitSector === '1') {
|
||||||
|
// Use date_of_birth if available, otherwise birth_incorp_date
|
||||||
|
$dateToUse = $customer->date_of_birth ?: $customer->birth_incorp_date;
|
||||||
|
} else {
|
||||||
|
// Use birth_incorp_date for sector > 1
|
||||||
|
$dateToUse = $customer->birth_incorp_date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no date found, fallback to account number
|
||||||
|
if (!$dateToUse) {
|
||||||
|
Log::warning("No date found for account {$accountNumber}, using account number as password");
|
||||||
|
return $accountNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Parse the date and format it
|
||||||
|
$date = Carbon::parse($dateToUse);
|
||||||
|
$day = $date->format('d');
|
||||||
|
$month = $date->format('M'); // 3-letter month abbreviation
|
||||||
|
$year = $date->format('Y');
|
||||||
|
|
||||||
|
// Format: ddMmmyyyyXX (e.g., 05Oct202585)
|
||||||
|
$password = $day . $month . $year . $lastTwoDigits;
|
||||||
|
|
||||||
|
return $password;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error("Error parsing date for account {$accountNumber}: {$e->getMessage()}");
|
||||||
|
return $accountNumber; // Fallback to account number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ class CombinePdfController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Generate password based on customer relation data
|
// Generate password based on customer relation data
|
||||||
$password = $this->generatePassword($account);
|
$password = generatePassword($account);
|
||||||
|
|
||||||
// Dispatch job to combine PDFs or apply password protection
|
// Dispatch job to combine PDFs or apply password protection
|
||||||
CombinePdfJob::dispatch($pdfFiles, $outputDir, $outputFilename, $password, $output_destination, $branchCode, $period);
|
CombinePdfJob::dispatch($pdfFiles, $outputDir, $outputFilename, $password, $output_destination, $branchCode, $period);
|
||||||
@@ -158,58 +158,4 @@ class CombinePdfController extends Controller
|
|||||||
'period' => $period
|
'period' => $period
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate password based on customer relation data
|
|
||||||
* Format: date+end 2 digit account_number
|
|
||||||
* Example: 05Oct202585
|
|
||||||
*
|
|
||||||
* @param Account $account
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
private function generatePassword(Account $account)
|
|
||||||
{
|
|
||||||
$customer = $account->customer;
|
|
||||||
$accountNumber = $account->account_number;
|
|
||||||
|
|
||||||
// Get last 2 digits of account number
|
|
||||||
$lastTwoDigits = substr($accountNumber, -2);
|
|
||||||
|
|
||||||
// Determine which date to use based on sector
|
|
||||||
$dateToUse = null;
|
|
||||||
|
|
||||||
if ($customer && $customer->sector) {
|
|
||||||
$firstDigitSector = substr($customer->sector, 0, 1);
|
|
||||||
|
|
||||||
if ($firstDigitSector === '1') {
|
|
||||||
// Use date_of_birth if available, otherwise birth_incorp_date
|
|
||||||
$dateToUse = $customer->date_of_birth ?: $customer->birth_incorp_date;
|
|
||||||
} else {
|
|
||||||
// Use birth_incorp_date for sector > 1
|
|
||||||
$dateToUse = $customer->birth_incorp_date;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no date found, fallback to account number
|
|
||||||
if (!$dateToUse) {
|
|
||||||
Log::warning("No date found for account {$accountNumber}, using account number as password");
|
|
||||||
return $accountNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Parse the date and format it
|
|
||||||
$date = Carbon::parse($dateToUse);
|
|
||||||
$day = $date->format('d');
|
|
||||||
$month = $date->format('M'); // 3-letter month abbreviation
|
|
||||||
$year = $date->format('Y');
|
|
||||||
|
|
||||||
// Format: ddMmmyyyyXX (e.g., 05Oct202585)
|
|
||||||
$password = $day . $month . $year . $lastTwoDigits;
|
|
||||||
|
|
||||||
return $password;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error("Error parsing date for account {$accountNumber}: {$e->getMessage()}");
|
|
||||||
return $accountNumber; // Fallback to account number
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ ini_set('max_execution_time', 300000);
|
|||||||
$validated['failed_count'] = 0;
|
$validated['failed_count'] = 0;
|
||||||
$validated['stmt_sent_type'] = $request->input('stmt_sent_type') ? implode(",",$request->input('stmt_sent_type')) : '';
|
$validated['stmt_sent_type'] = $request->input('stmt_sent_type') ? implode(",",$request->input('stmt_sent_type')) : '';
|
||||||
$validated['branch_code'] = $validated['branch_code'] ?? $branch_code; // Awal tidak tersedia
|
$validated['branch_code'] = $validated['branch_code'] ?? $branch_code; // Awal tidak tersedia
|
||||||
|
$validated['password'] = $request->input('password') ?? '';
|
||||||
// Create the statement log
|
// Create the statement log
|
||||||
$statement = PrintStatementLog::create($validated);
|
$statement = PrintStatementLog::create($validated);
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ use Modules\Webstatement\Models\{
|
|||||||
};
|
};
|
||||||
use Modules\Basicdata\Models\Branch;
|
use Modules\Basicdata\Models\Branch;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Owenoj\PDFPasswordProtect\Facade\PDFPasswordProtect;
|
||||||
|
|
||||||
class ExportStatementPeriodJob implements ShouldQueue
|
class ExportStatementPeriodJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
@@ -469,10 +470,10 @@ class ExportStatementPeriodJob implements ShouldQueue
|
|||||||
$saldoAwalBulan = (object) ['actual_balance' => (float) $this->saldo];
|
$saldoAwalBulan = (object) ['actual_balance' => (float) $this->saldo];
|
||||||
|
|
||||||
// Generate filename
|
// Generate filename
|
||||||
$filename = "statement_{$this->account_number}_{$this->period}.pdf";
|
$filename = "{$this->account_number}_{$this->period}.pdf";
|
||||||
|
|
||||||
// Tentukan path storage
|
// Tentukan path storage
|
||||||
$storagePath = "statements/{$this->period}/{$this->account_number}";
|
$storagePath = "statements/{$this->period}/{$account->branch_code}";
|
||||||
$tempPath = storage_path("app/temp/{$filename}");
|
$tempPath = storage_path("app/temp/{$filename}");
|
||||||
$fullStoragePath = "{$storagePath}/{$filename}";
|
$fullStoragePath = "{$storagePath}/{$filename}";
|
||||||
|
|
||||||
@@ -502,6 +503,8 @@ class ExportStatementPeriodJob implements ShouldQueue
|
|||||||
'html_length' => strlen($html)
|
'html_length' => strlen($html)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
// Di dalam fungsi generatePdf(), setelah Browsershot::html()->save($tempPath)
|
||||||
// Generate PDF menggunakan Browsershot
|
// Generate PDF menggunakan Browsershot
|
||||||
Browsershot::html($html)
|
Browsershot::html($html)
|
||||||
->showBackground()
|
->showBackground()
|
||||||
@@ -518,6 +521,28 @@ class ExportStatementPeriodJob implements ShouldQueue
|
|||||||
throw new Exception('PDF file gagal dibuat');
|
throw new Exception('PDF file gagal dibuat');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$printLog = PrintStatementLog::find($this->statementId);
|
||||||
|
|
||||||
|
// Apply password protection jika diperlukan
|
||||||
|
$password = $printLog->password ?? generatePassword($account); // Ambil dari config atau set default
|
||||||
|
if (!empty($password)) {
|
||||||
|
$tempProtectedPath = storage_path("app/temp/protected_{$filename}");
|
||||||
|
|
||||||
|
// Encrypt PDF dengan password
|
||||||
|
PDFPasswordProtect::encrypt($tempPath, $tempProtectedPath, $password);
|
||||||
|
|
||||||
|
// Ganti file original dengan yang sudah diproteksi
|
||||||
|
if (file_exists($tempProtectedPath)) {
|
||||||
|
unlink($tempPath); // Hapus file original
|
||||||
|
rename($tempProtectedPath, $tempPath); // Rename protected file ke original path
|
||||||
|
|
||||||
|
Log::info('ExportStatementPeriodJob: PDF password protection applied', [
|
||||||
|
'account_number' => $this->account_number,
|
||||||
|
'period' => $this->period
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$fileSize = filesize($tempPath);
|
$fileSize = filesize($tempPath);
|
||||||
|
|
||||||
// Pindahkan file ke storage permanen
|
// Pindahkan file ke storage permanen
|
||||||
@@ -525,7 +550,7 @@ class ExportStatementPeriodJob implements ShouldQueue
|
|||||||
Storage::put($fullStoragePath, $pdfContent);
|
Storage::put($fullStoragePath, $pdfContent);
|
||||||
|
|
||||||
// Update print statement log
|
// Update print statement log
|
||||||
$printLog = PrintStatementLog::find($this->statementId);
|
|
||||||
if ($printLog) {
|
if ($printLog) {
|
||||||
$printLog->update([
|
$printLog->update([
|
||||||
'is_available' => true,
|
'is_available' => true,
|
||||||
@@ -580,20 +605,12 @@ class ExportStatementPeriodJob implements ShouldQueue
|
|||||||
private function exportToCsv(): void
|
private function exportToCsv(): void
|
||||||
{
|
{
|
||||||
// Determine the base path based on client
|
// Determine the base path based on client
|
||||||
$basePath = !empty($this->client)
|
$account = Account::where('account_number', $this->account_number)->first();
|
||||||
? "statements/{$this->client}"
|
|
||||||
: "statements";
|
|
||||||
|
|
||||||
// Create client directory if it doesn't exist
|
$storagePath = "statements/{$this->period}/{$account->branch_code}";
|
||||||
if (!empty($this->client)) {
|
Storage::disk($this->disk)->makeDirectory($storagePath);
|
||||||
Storage::disk($this->disk)->makeDirectory($basePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create account directory
|
$filePath = "{$storagePath}/{$this->fileName}";
|
||||||
$accountPath = "{$basePath}/{$this->account_number}";
|
|
||||||
Storage::disk($this->disk)->makeDirectory($accountPath);
|
|
||||||
|
|
||||||
$filePath = "{$accountPath}/{$this->fileName}";
|
|
||||||
|
|
||||||
// Delete existing file if it exists
|
// Delete existing file if it exists
|
||||||
if (Storage::disk($this->disk)->exists($filePath)) {
|
if (Storage::disk($this->disk)->exists($filePath)) {
|
||||||
|
|||||||
@@ -247,10 +247,11 @@ class GenerateMultiAccountPdfJob implements ShouldQueue
|
|||||||
Browsershot::html($html)
|
Browsershot::html($html)
|
||||||
->showBackground()
|
->showBackground()
|
||||||
->setOption('addStyleTag', json_encode(['content' => '@page { margin: 0; }']))
|
->setOption('addStyleTag', json_encode(['content' => '@page { margin: 0; }']))
|
||||||
|
->setOption('protocolTimeout', 2147483) // 2 menit timeout
|
||||||
->format('A4')
|
->format('A4')
|
||||||
->margins(0, 0, 0, 0)
|
->margins(0, 0, 0, 0)
|
||||||
->waitUntilNetworkIdle()
|
->waitUntil('load')
|
||||||
->timeout(60000)
|
->timeout(2147483)
|
||||||
->save($pdfPath);
|
->save($pdfPath);
|
||||||
|
|
||||||
// Verify file was created
|
// Verify file was created
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class PrintStatementLog extends Model
|
|||||||
'email_sent_at',
|
'email_sent_at',
|
||||||
'stmt_sent_type',
|
'stmt_sent_type',
|
||||||
'is_generated',
|
'is_generated',
|
||||||
|
'password', // Tambahan field password
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -60,6 +61,10 @@ class PrintStatementLog extends Model
|
|||||||
'target_accounts' => 'array',
|
'target_accounts' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
'password', // Hide password dari serialization
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the formatted period display
|
* Get the formatted period display
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Menjalankan migrasi untuk menambahkan kolom password ke tabel print_statement_logs
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('print_statement_logs', function (Blueprint $table) {
|
||||||
|
// Menambahkan kolom password setelah kolom stmt_sent_type
|
||||||
|
$table->string('password', 255)->nullable()->after('stmt_sent_type')
|
||||||
|
->comment('Password untuk proteksi PDF statement');
|
||||||
|
|
||||||
|
// Menambahkan index untuk performa query jika diperlukan
|
||||||
|
$table->index(['password'], 'idx_print_statement_logs_password');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Membalikkan migrasi dengan menghapus kolom password
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('print_statement_logs', function (Blueprint $table) {
|
||||||
|
// Hapus index terlebih dahulu
|
||||||
|
$table->dropIndex('idx_print_statement_logs_password');
|
||||||
|
|
||||||
|
// Hapus kolom password
|
||||||
|
$table->dropColumn('password');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-5">
|
<div class="grid grid-cols-1 gap-5">
|
||||||
@if ($multiBranch)
|
@if (!$multiBranch)
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label required" for="branch_code">Branch/Cabang</label>
|
<label class="form-label required" for="branch_code">Branch/Cabang</label>
|
||||||
<select
|
<select
|
||||||
@@ -107,6 +107,22 @@
|
|||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Tambahan field password -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="password">PDF Password</label>
|
||||||
|
<input type="password"
|
||||||
|
class="input form-control @error('password') border-danger bg-danger-light @enderror"
|
||||||
|
id="password" name="password" value="{{ old('password', $statement->password ?? '') }}"
|
||||||
|
placeholder="Optional password untuk proteksi PDF statement" autocomplete="new-password">
|
||||||
|
<div class="mt-1 text-xs text-primary">
|
||||||
|
<i class="text-sm ki-outline ki-information-5"></i>
|
||||||
|
Jika dikosongkan password default statement akan diberlakukan
|
||||||
|
</div>
|
||||||
|
@error('password')
|
||||||
|
<div class="text-sm alert text-danger">{{ $message }}</div>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label required" for="start_date">Start Date</label>
|
<label class="form-label required" for="start_date">Start Date</label>
|
||||||
|
|
||||||
@@ -141,7 +157,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-span-6">
|
<div class="col-span-6">
|
||||||
<div class="min-w-full card card-grid" data-datatable="false" data-datatable-page-size="10"
|
<div class="min-w-full card card-grid" data-datatable="false" data-datatable-page-size="10"
|
||||||
data-datatable-state-save="false" id="statement-table" data-api-url="{{ route('statements.datatables') }}">
|
data-datatable-state-save="false" id="statement-table"
|
||||||
|
data-api-url="{{ route('statements.datatables') }}">
|
||||||
<div class="flex-wrap py-5 card-header">
|
<div class="flex-wrap py-5 card-header">
|
||||||
<div class="min-w-full card card-grid" data-datatable="false" data-datatable-page-size="10"
|
<div class="min-w-full card card-grid" data-datatable="false" data-datatable-page-size="10"
|
||||||
data-datatable-state-save="false" id="statement-table"
|
data-datatable-state-save="false" id="statement-table"
|
||||||
@@ -218,9 +235,6 @@
|
|||||||
<select class="w-16 select select-sm" data-datatable-size="true"
|
<select class="w-16 select select-sm" data-datatable-size="true"
|
||||||
name="perpage"> </select>
|
name="perpage"> </select>
|
||||||
per page
|
per page
|
||||||
<select class="w-16 select select-sm" data-datatable-size="true"
|
|
||||||
name="perpage"> </select>
|
|
||||||
per page
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-4 items-center">
|
<div class="flex gap-4 items-center">
|
||||||
<div class="flex gap-4 items-center">
|
<div class="flex gap-4 items-center">
|
||||||
@@ -273,51 +287,76 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Konfirmasi email sebelum submit form
|
* Konfirmasi password dan email sebelum submit form
|
||||||
* Menampilkan SweetAlert jika email diisi untuk konfirmasi pengiriman
|
* Menampilkan SweetAlert jika password atau email diisi untuk konfirmasi
|
||||||
*/
|
*/
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
const form = document.querySelector('form');
|
const form = document.querySelector('form');
|
||||||
const emailInput = document.getElementById('email');
|
const emailInput = document.getElementById('email');
|
||||||
|
const passwordInput = document.getElementById('password');
|
||||||
|
|
||||||
// Log: Inisialisasi event listener untuk konfirmasi email
|
// Log: Inisialisasi event listener untuk konfirmasi
|
||||||
console.log('Email confirmation listener initialized');
|
console.log('Form confirmation listener initialized');
|
||||||
|
|
||||||
form.addEventListener('submit', function(e) {
|
form.addEventListener('submit', function(e) {
|
||||||
const emailValue = emailInput.value.trim();
|
const emailValue = emailInput.value.trim();
|
||||||
|
const passwordValue = passwordInput.value.trim();
|
||||||
|
|
||||||
// Jika email diisi, tampilkan konfirmasi
|
let confirmationNeeded = false;
|
||||||
|
let confirmationMessage = '';
|
||||||
|
|
||||||
|
// Jika email diisi
|
||||||
if (emailValue) {
|
if (emailValue) {
|
||||||
|
confirmationNeeded = true;
|
||||||
|
confirmationMessage += `• Statement akan dikirim ke email: ${emailValue}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jika password diisi
|
||||||
|
if (passwordValue) {
|
||||||
|
confirmationNeeded = true;
|
||||||
|
confirmationMessage += `• PDF akan diproteksi dengan password\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jika ada yang perlu dikonfirmasi
|
||||||
|
if (confirmationNeeded) {
|
||||||
e.preventDefault(); // Hentikan submit form sementara
|
e.preventDefault(); // Hentikan submit form sementara
|
||||||
|
|
||||||
// Log: Email terdeteksi, menampilkan konfirmasi
|
// Log: Konfirmasi diperlukan
|
||||||
console.log('Email detected:', emailValue);
|
console.log('Confirmation needed:', {
|
||||||
|
email: emailValue,
|
||||||
|
hasPassword: !!passwordValue
|
||||||
|
});
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Konfirmasi Pengiriman Email',
|
title: 'Konfirmasi Request Statement',
|
||||||
text: `Apakah Anda yakin ingin mengirimkan statement ke email: ${emailValue}?`,
|
text: `Mohon konfirmasi pengaturan berikut:\n\n${confirmationMessage}\nApakah Anda yakin ingin melanjutkan?`,
|
||||||
icon: 'question',
|
icon: 'question',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: '#3085d6',
|
confirmButtonColor: '#3085d6',
|
||||||
cancelButtonColor: '#d33',
|
cancelButtonColor: '#d33',
|
||||||
confirmButtonText: 'Ya, Kirim Email',
|
confirmButtonText: 'Ya, Lanjutkan',
|
||||||
cancelButtonText: 'Batal',
|
cancelButtonText: 'Batal',
|
||||||
reverseButtons: true
|
reverseButtons: true,
|
||||||
|
preConfirm: () => {
|
||||||
|
// Validasi password jika diisi
|
||||||
|
if (passwordValue && passwordValue.length < 6) {
|
||||||
|
Swal.showValidationMessage('Password minimal 6 karakter');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
// Log: User konfirmasi pengiriman email
|
// Log: User konfirmasi
|
||||||
console.log('User confirmed email sending');
|
console.log('User confirmed form submission');
|
||||||
|
|
||||||
// Submit form setelah konfirmasi
|
// Submit form setelah konfirmasi
|
||||||
form.submit();
|
form.submit();
|
||||||
} else {
|
} else {
|
||||||
// Log: User membatalkan pengiriman email
|
// Log: User membatalkan
|
||||||
console.log('User cancelled email sending');
|
console.log('User cancelled form submission');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
// Log: Tidak ada email, submit form normal
|
|
||||||
console.log('No email provided, submitting form normally');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -351,7 +390,7 @@
|
|||||||
account_number: {
|
account_number: {
|
||||||
title: 'Account Number',
|
title: 'Account Number',
|
||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
if(data.request_type=="multi_account"){
|
if (data.request_type == "multi_account") {
|
||||||
return data.stmt_sent_type ?? 'N/A';
|
return data.stmt_sent_type ?? 'N/A';
|
||||||
}
|
}
|
||||||
return data.account_number ?? '';
|
return data.account_number ?? '';
|
||||||
|
|||||||
Reference in New Issue
Block a user