diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs index ac7bf247..38f81b8f 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Administration.cs @@ -821,6 +821,54 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep }), FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { new FieldsDefaultValue() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } + }), + WidgetsJson = JsonSerializer.Serialize(new List + { + new() + { + ColGap = 3, + ColSpan = 4, + SqlQuery = @" + SELECT + 'Aktif' AS ""Title"", + COUNT(""Id"") AS ""Value"", + 'blue' AS ""Color"", + 'Aktif Kullanıcılar' AS ""SubTitle"", + 'FaUserCheck' AS ""Icon"" + FROM ""AbpUsers"" + WHERE ""IsActive"" = 'true' + + UNION ALL + + SELECT + 'Pasif' AS ""Title"", + COUNT(""Id"") AS ""Value"", + 'green' AS ""Color"", + 'Pasif Kullanıcılar' AS ""SubTitle"", + 'FaUserSlash' AS ""Icon"" + FROM ""AbpUsers"" + WHERE ""IsActive"" = 'false' + + UNION ALL + + SELECT + 'Doğrulama' AS ""Title"", + COUNT(""Id"") AS ""Value"", + 'purple' AS ""Color"", + 'Yönetici Doğrulaması bekleyenler' AS ""SubTitle"", + 'FaUserClock' AS ""Icon"" + FROM ""AbpUsers"" + WHERE ""IsVerified"" = 'false'; + ", + Title = "Title", + Value = "Value", + ValueClassName = "bg-5 text-sm", + Color = "Color", + Icon = "Icon", + SubTitle = "SubTitle", + ClassName = "mb-3", + IsActive = true + } }) }); diff --git a/ui/src/views/admin/listForm/edit/json-row-operations/JsonRowOpDialogWidget.tsx b/ui/src/views/admin/listForm/edit/json-row-operations/JsonRowOpDialogWidget.tsx index 733726b7..db503ce7 100644 --- a/ui/src/views/admin/listForm/edit/json-row-operations/JsonRowOpDialogWidget.tsx +++ b/ui/src/views/admin/listForm/edit/json-row-operations/JsonRowOpDialogWidget.tsx @@ -10,6 +10,7 @@ import { toast, Tooltip, } from '@/components/ui' +import SqlEditor from '@/views/sqlQueryManager/components/SqlEditor' import { ListFormJsonRowDto } from '@/proxy/admin/list-form/models' import { SelectBoxOption } from '@/types/shared' import { useStoreActions, useStoreState } from '@/store' @@ -89,16 +90,17 @@ function JsonRowOpDialogWidget({ data.widgetValues ?? { colGap: 3, colSpan: 3, - sqlQuery: '', + sqlQuery: + "SELECT 'Total Records' as title, COUNT(*) as value, 'blue' as color, 'FaChartBar' as icon, 'Active records' as subTitle FROM YourTable WHERE IsActive = 1", className: 'mb-3', valueClassName: 'bg-5 text-sm', - title: 'Title', - value: 'Value', - color: 'Color', - icon: 'Icon', - subTitle: 'SubTitle', + title: 'title', + value: 'value', + color: 'color', + icon: 'icon', + subTitle: 'subTitle', onClick: '', - isActive: false, + isActive: true, } } validationSchema={schema} @@ -135,11 +137,11 @@ function JsonRowOpDialogWidget({ } }} > - {({ touched, errors, values, isSubmitting }) => ( + {({ touched, errors, values, isSubmitting, setFieldValue }) => (
-
-
+
+
+ +
Widget Container CSS Classes
+
Examples: mb-3, mt-2, p-4, rounded-lg, shadow-md
+
+ } + > + + + + + + +
Value Display CSS Classes
+
Examples: text-3xl, text-2xl, font-bold, text-sm, text-center
+
+ } + > + + + + +
+ +
SQL Query Examples:
+
+
+ + SELECT 'Aktif' as title, COUNT(Id) as value, +
+   'blue' as color, 'FaChartBar' as icon, +
+   'Aktif kayıtlar' as subTitle +
+ FROM YourTable WHERE IsActive = 1 +
+
+
+
+ } + > + Sql Query + + - +
+ setFieldValue('sqlQuery', value || '')} + height="200px" + /> +
-
- SQL Query Fields -
-
+
@@ -231,12 +300,30 @@ function JsonRowOpDialogWidget({ type="text" autoComplete="off" name="value" - placeholder="Value Field" + placeholder="Column name from SQL query e.g., 'value'" component={Input} /> - + +
Available Colors:
+
+
• blue
+
• green
+
• purple
+
• gray
+
• red
+
• yellow
+
• pink
+
• indigo
+
• teal
+
• orange
+
+
+ } + > @@ -254,7 +341,45 @@ function JsonRowOpDialogWidget({ +
Popular Icon Examples:
+
+
+ 📊 Charts: FaChartBar, FaChartLine, FaChartPie, + FaChartArea +
+
+ 💰 Finance: FaDollarSign, FaMoneyBill, FaWallet, + FaCreditCard +
+
+ 👥 Users: FaUser, FaUsers, FaUserCircle, FaUserTie +
+
+ 📦 Business: FaShoppingCart, FaBoxes, FaWarehouse, + FaTruck +
+
+ 📈 Analytics: FaArrowUp, FaArrowDown, + FaArrowTrendUp +
+
+ ⚙️ Settings: FaCog, FaTools, FaWrench +
+
+ 🔔 Alerts: FaBell, FaExclamation, FaInfoCircle +
+
+ 📁 Files: FaFile, FaFolder, FaFileAlt, FaDownload +
+
+ 🏠 Other: FaHome, FaBuilding, FaGlobe, FaHeart +
+
+
+ All icons from react-icons/fa (Font Awesome) +
+
} > @@ -281,55 +406,27 @@ function JsonRowOpDialogWidget({ type="text" autoComplete="off" name="subTitle" - placeholder="Sub Title" - component={Input} - /> - - - - - - - - -
+