137 lines
5.5 KiB
PowerShell
137 lines
5.5 KiB
PowerShell
Add-Type -AssemblyName System.Drawing
|
|
|
|
$output = Join-Path $PSScriptRoot 'flowchart-sistem-utama.jpg'
|
|
$width = 1800
|
|
$height = 2200
|
|
$bitmap = New-Object System.Drawing.Bitmap $width, $height
|
|
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
|
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
|
|
$graphics.TextRenderingHint = [System.Drawing.Text.TextRenderingHint]::ClearTypeGridFit
|
|
|
|
$graphics.Clear([System.Drawing.Color]::White)
|
|
|
|
$titleFont = New-Object System.Drawing.Font('Segoe UI', 30, [System.Drawing.FontStyle]::Bold)
|
|
$boxFont = New-Object System.Drawing.Font('Segoe UI', 16, [System.Drawing.FontStyle]::Regular)
|
|
$smallFont = New-Object System.Drawing.Font('Segoe UI', 13, [System.Drawing.FontStyle]::Regular)
|
|
$textBrush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(25, 33, 45))
|
|
$linePen = New-Object System.Drawing.Pen([System.Drawing.Color]::FromArgb(55, 65, 81), 3)
|
|
$arrowPen = New-Object System.Drawing.Pen([System.Drawing.Color]::FromArgb(55, 65, 81), 3)
|
|
$arrowPen.CustomEndCap = New-Object System.Drawing.Drawing2D.AdjustableArrowCap(7, 7)
|
|
|
|
$userBrush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(232, 246, 239))
|
|
$systemBrush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(232, 240, 255))
|
|
$adminBrush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(255, 243, 226))
|
|
$decisionBrush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(250, 250, 252))
|
|
|
|
$format = New-Object System.Drawing.StringFormat
|
|
$format.Alignment = [System.Drawing.StringAlignment]::Center
|
|
$format.LineAlignment = [System.Drawing.StringAlignment]::Center
|
|
|
|
function Draw-Box {
|
|
param(
|
|
[int] $X,
|
|
[int] $Y,
|
|
[int] $W,
|
|
[int] $H,
|
|
[string] $Text,
|
|
[System.Drawing.Brush] $Brush
|
|
)
|
|
|
|
$rect = [System.Drawing.Rectangle]::new($X, $Y, $W, $H)
|
|
$graphics.FillRectangle($Brush, $rect)
|
|
$graphics.DrawRectangle($linePen, $rect)
|
|
$textRect = [System.Drawing.RectangleF]::new(($X + 12), ($Y + 8), ($W - 24), ($H - 16))
|
|
$graphics.DrawString($Text, $boxFont, $textBrush, $textRect, $format)
|
|
}
|
|
|
|
function Draw-Decision {
|
|
param(
|
|
[int] $X,
|
|
[int] $Y,
|
|
[int] $W,
|
|
[int] $H,
|
|
[string] $Text
|
|
)
|
|
|
|
$points = @(
|
|
[System.Drawing.Point]::new($X + [int]($W / 2), $Y),
|
|
[System.Drawing.Point]::new($X + $W, $Y + [int]($H / 2)),
|
|
[System.Drawing.Point]::new($X + [int]($W / 2), $Y + $H),
|
|
[System.Drawing.Point]::new($X, $Y + [int]($H / 2))
|
|
)
|
|
|
|
$graphics.FillPolygon($decisionBrush, $points)
|
|
$graphics.DrawPolygon($linePen, $points)
|
|
$textRect = [System.Drawing.RectangleF]::new(($X + 28), ($Y + 18), ($W - 56), ($H - 36))
|
|
$graphics.DrawString($Text, $boxFont, $textBrush, $textRect, $format)
|
|
}
|
|
|
|
function Draw-Arrow {
|
|
param(
|
|
[int] $X1,
|
|
[int] $Y1,
|
|
[int] $X2,
|
|
[int] $Y2,
|
|
[string] $Label = ''
|
|
)
|
|
|
|
$graphics.DrawLine($arrowPen, $X1, $Y1, $X2, $Y2)
|
|
|
|
if ($Label) {
|
|
$midX = [int](($X1 + $X2) / 2)
|
|
$midY = [int](($Y1 + $Y2) / 2)
|
|
$labelRect = [System.Drawing.RectangleF]::new(($midX - 85), ($midY - 20), 170, 36)
|
|
$graphics.FillRectangle([System.Drawing.Brushes]::White, $labelRect)
|
|
$graphics.DrawString($Label, $smallFont, $textBrush, $labelRect, $format)
|
|
}
|
|
}
|
|
|
|
$graphics.DrawString('Flowchart Sistem Jual Mobil Bekas JMW', $titleFont, $textBrush, [System.Drawing.RectangleF]::new(0, 30, $width, 65), $format)
|
|
|
|
Draw-Box 725 130 350 70 'Mulai' $systemBrush
|
|
Draw-Box 725 250 350 90 'User membuka website' $userBrush
|
|
Draw-Decision 700 390 400 130 'Sudah login?'
|
|
Draw-Box 225 580 350 95 'Login / Register' $userBrush
|
|
Draw-Box 725 580 350 95 'Katalog mobil bekas' $userBrush
|
|
Draw-Box 1225 580 350 95 'Dashboard admin' $adminBrush
|
|
Draw-Box 725 770 350 100 'Release reservasi kedaluwarsa' $systemBrush
|
|
Draw-Decision 700 940 400 130 'Pilih fitur user'
|
|
Draw-Box 180 1150 430 105 'Input budget dan lihat rekomendasi' $userBrush
|
|
Draw-Box 685 1150 430 105 'Detail mobil dan hubungi WhatsApp admin' $userBrush
|
|
Draw-Box 1190 1150 430 105 'Kelola mobil, transaksi, dan laporan' $adminBrush
|
|
Draw-Box 180 1350 430 115 'Flask API K-Means / fallback Laravel mencari rekomendasi' $systemBrush
|
|
Draw-Decision 700 1360 400 130 'User klik bayar?'
|
|
Draw-Box 725 1550 350 105 'Buat transaksi pending' $systemBrush
|
|
Draw-Box 725 1710 350 105 'Mobil menjadi reserved' $systemBrush
|
|
Draw-Decision 700 1870 400 130 'Upload bukti sebelum 10 menit?'
|
|
Draw-Box 225 2030 350 95 'Kedaluwarsa: transaksi cancelled, mobil available' $systemBrush
|
|
Draw-Box 725 2030 350 95 'Menunggu konfirmasi admin' $systemBrush
|
|
Draw-Box 1225 2030 350 95 'Admin konfirmasi: transaksi paid, mobil sold' $adminBrush
|
|
|
|
Draw-Arrow 900 200 900 250
|
|
Draw-Arrow 900 340 900 390
|
|
Draw-Arrow 700 455 575 625 'belum'
|
|
Draw-Arrow 900 520 900 580 'user'
|
|
Draw-Arrow 1100 455 1225 625 'admin'
|
|
Draw-Arrow 575 628 725 628
|
|
Draw-Arrow 900 675 900 770
|
|
Draw-Arrow 900 870 900 940
|
|
Draw-Arrow 700 1005 610 1200 'budget'
|
|
Draw-Arrow 900 1070 900 1150 'detail'
|
|
Draw-Arrow 1100 1005 1190 1200 'admin'
|
|
Draw-Arrow 395 1255 395 1350
|
|
Draw-Arrow 610 1408 700 1425
|
|
Draw-Arrow 900 1255 900 1360
|
|
Draw-Arrow 900 1490 900 1550 'ya'
|
|
Draw-Arrow 900 1655 900 1710
|
|
Draw-Arrow 900 1815 900 1870
|
|
Draw-Arrow 700 1935 575 2078 'tidak'
|
|
Draw-Arrow 900 2000 900 2030 'ya'
|
|
Draw-Arrow 1075 2078 1225 2078
|
|
|
|
$bitmap.Save($output, [System.Drawing.Imaging.ImageFormat]::Jpeg)
|
|
$graphics.Dispose()
|
|
$bitmap.Dispose()
|
|
|
|
Get-Item $output | Select-Object FullName, Length
|