ListFormField için AllowAdding özelliği eklendi

This commit is contained in:
Sedat Öztürk 2026-04-25 21:12:31 +03:00
parent 3ac72ad19b
commit 5dbd8a0f3f
29 changed files with 106 additions and 55 deletions

View file

@ -80,6 +80,7 @@ public class ColumnFormatDto : AuditedEntityDto<Guid>
/// </summary>
public bool AllowSearch { get; set; } = false;
public bool AllowEditing { get; set; } = true;
public bool AllowAdding { get; set; } = true;
public string ColumnCssClass { get; set; } // Sutuna css sinif ismi
//[TextArea]
public string ColumnCssValue { get; set; } // Sutuna ait css sinifinin icerigi

View file

@ -13,7 +13,7 @@ public class GridEditingDto
/// <summary>Accepted Values: 'full' | 'reshape' | 'repaint'
/// </summary>
public string RefreshMode { get; set; } = "full";
public bool AllowEditing { get; set; } = false;
public bool AllowUpdating { get; set; } = false;
public bool AllowDetail { get; set; } = false;
public bool AllowDeleting { get; set; } = false;
public bool AllowAllDeleting { get; set; } = false;

View file

@ -15,7 +15,7 @@ public class ListFormWizardDto
public bool IsOrganizationUnit { get; set; }
public bool AllowAdding { get; set; }
public bool AllowEditing { get; set; }
public bool AllowUpdating { get; set; }
public bool AllowDeleting { get; set; }
public bool AllowDetail { get; set; }
public bool ConfirmDelete { get; set; }

View file

@ -58,6 +58,7 @@ public class ListFormFieldsAppService : CrudAppService<
entity.Visible = updateInput.Visible;
entity.AllowSearch = updateInput.AllowSearch;
entity.AllowEditing = updateInput.AllowEditing;
entity.AllowAdding = updateInput.AllowAdding;
entity.ListOrderNo = updateInput.ListOrderNo;
entity.SourceDbType = updateInput.SourceDbType;
entity.Width = updateInput.Width;
@ -150,6 +151,7 @@ public class ListFormFieldsAppService : CrudAppService<
item.Visible = input.Visible;
item.AllowSearch = input.AllowSearch;
item.AllowEditing = input.AllowEditing;
item.AllowAdding = input.AllowAdding;
}
else if (input.EditType == ListFormFieldEditTabs.CustomizationForm)
{
@ -266,6 +268,7 @@ public class ListFormFieldsAppService : CrudAppService<
field.Visible = sourceField.Visible;
field.AllowSearch = sourceField.AllowSearch;
field.AllowEditing = sourceField.AllowEditing;
field.AllowAdding = sourceField.AllowAdding;
}
else if (input.CopiedFields.All || input.CopiedFields.Permission)
{

View file

@ -220,7 +220,7 @@ public class ListFormWizardAppService(
DeleteFieldsDefaultValueJson = WizardConsts.DefaultDeleteFieldsDefaultValueJson(input.KeyFieldDbSourceType),
InsertFieldsDefaultValueJson = WizardConsts.DefaultInsertFieldsDefaultValueJson(input.KeyFieldDbSourceType),
PagerOptionJson = WizardConsts.DefaultPagerOptionJson,
EditingOptionJson = WizardConsts.DefaultEditingOptionJson(titleLangKey, 600, 500, input.AllowDeleting, input.AllowAdding, input.AllowEditing, input.ConfirmDelete, false, input.AllowDetail),
EditingOptionJson = WizardConsts.DefaultEditingOptionJson(titleLangKey, 600, 500, input.AllowDeleting, input.AllowAdding, input.AllowUpdating, input.ConfirmDelete, false, input.AllowDetail),
EditingFormJson = editingFormDtos.Count > 0 ? JsonSerializer.Serialize(editingFormDtos) : null,
}, autoSave: true);

View file

@ -4530,12 +4530,24 @@
"en": "Auto Expand All",
"tr": "Otomatik Tümünü Genişlet"
},
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.AllowUpdating",
"en": "Allow Updating",
"tr": "Güncellemeye İzin Ver"
},
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.AllowEditing",
"en": "Allow Editing",
"tr": "Düzenlemeye İzin Ver"
},
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.AllowAdding",
"en": "Allow Adding",
"tr": "Ekleme İzni"
},
{
"resourceName": "Platform",
"key": "ListForms.ListFormEdit.AllowTaskAdding",

View file

@ -35,7 +35,7 @@ public static class ListFormSeeder_DefaultJsons
int Height,
bool AllowDeleting,
bool AllowAdding,
bool AllowEditing,
bool AllowUpdating,
bool ConfirmDelete,
bool SendOnlyChangedFormValuesUpdate,
bool AllowDetail = false) => JsonSerializer.Serialize(new GridEditingDto
@ -43,7 +43,7 @@ public static class ListFormSeeder_DefaultJsons
Popup = new GridEditingPopupDto() { Title = Title, Width = Width, Height = Height },
AllowDeleting = AllowDeleting,
AllowAdding = AllowAdding,
AllowEditing = AllowEditing,
AllowUpdating = AllowUpdating,
ConfirmDelete = ConfirmDelete,
SendOnlyChangedFormValuesUpdate = SendOnlyChangedFormValuesUpdate,
AllowDetail = AllowDetail

View file

@ -198,7 +198,7 @@ public static class WizardConsts
int Height,
bool AllowDeleting,
bool AllowAdding,
bool AllowEditing,
bool AllowUpdating,
bool ConfirmDelete,
bool SendOnlyChangedFormValuesUpdate,
bool AllowDetail = false) => JsonSerializer.Serialize(new
@ -206,7 +206,7 @@ public static class WizardConsts
Popup = new { Title = Title, Width = Width, Height = Height },
AllowDeleting = AllowDeleting,
AllowAdding = AllowAdding,
AllowEditing = AllowEditing,
AllowUpdating = AllowUpdating,
ConfirmDelete = ConfirmDelete,
SendOnlyChangedFormValuesUpdate = SendOnlyChangedFormValuesUpdate,
AllowDetail = AllowDetail

View file

@ -23,7 +23,8 @@ public class ListFormField : FullAuditedEntity<Guid>
public string SortDirection { get; set; } // Sortindex varsa alacagi degerler asc, desc
public bool? AllowSearch { get; set; } = true;
public bool? AllowEditing { get; set; }
public bool? AllowEditing { get; set; } = true;
public bool? AllowAdding { get; set; } = true;
public string BandName { get; set; }
public string ColumnFilterJson { get; set; }

View file

@ -370,6 +370,7 @@ public class PlatformDbContext :
// Varsayılan değerler
b.Property(a => a.AllowSearch).HasDefaultValue(false);
b.Property(a => a.AllowEditing).HasDefaultValue(true);
b.Property(a => a.AllowAdding).HasDefaultValue(true);
b.Property(a => a.IsActive).HasDefaultValue(true);
b.Property(a => a.Visible).HasDefaultValue(true);
b.Property(a => a.ListOrderNo).HasDefaultValue(30);

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Sozsoft.Platform.Migrations
{
[DbContext(typeof(PlatformDbContext))]
[Migration("20260330120142_Initial")]
[Migration("20260425160411_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -2538,6 +2538,11 @@ namespace Sozsoft.Platform.Migrations
.HasColumnType("nvarchar(20)")
.HasDefaultValue("left");
b.Property<bool?>("AllowAdding")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool?>("AllowEditing")
.ValueGeneratedOnAdd()
.HasColumnType("bit")

View file

@ -2041,6 +2041,7 @@ namespace Sozsoft.Platform.Migrations
SortDirection = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
AllowSearch = table.Column<bool>(type: "bit", nullable: true, defaultValue: false),
AllowEditing = table.Column<bool>(type: "bit", nullable: true, defaultValue: true),
AllowAdding = table.Column<bool>(type: "bit", nullable: true, defaultValue: true),
BandName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
ColumnFilterJson = table.Column<string>(type: "text", nullable: true),
ColumnHeaderJson = table.Column<string>(type: "text", nullable: true),

View file

@ -2535,6 +2535,11 @@ namespace Sozsoft.Platform.Migrations
.HasColumnType("nvarchar(20)")
.HasDefaultValue("left");
b.Property<bool?>("AllowAdding")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool?>("AllowEditing")
.ValueGeneratedOnAdd()
.HasColumnType("bit")

View file

@ -39,7 +39,7 @@ export interface ListFormWizardDto {
isBranch: boolean
isOrganizationUnit: boolean
allowAdding: boolean
allowEditing: boolean
allowUpdating: boolean
allowDeleting: boolean
confirmDelete: boolean
allowDetail: boolean

View file

@ -209,6 +209,7 @@ export interface ColumnFormatDto extends AuditedEntityDto<string> {
sortDirection?: string
allowSearch: boolean
allowEditing: boolean
allowAdding: boolean
columnCssClass?: string
columnCssValue?: string
bandName?: string
@ -440,7 +441,7 @@ export interface SchedulerResourceDto {
export interface GridEditingDto {
mode?: GridsEditMode
refreshMode?: GridsEditRefreshMode
allowEditing: boolean
allowUpdating: boolean
allowDetail: boolean
allowDeleting: boolean
allowAllDeleting: boolean

View file

@ -39,7 +39,7 @@ const initialValues: ListFormWizardDto = {
isBranch: false,
isOrganizationUnit: false,
allowAdding: true,
allowEditing: true,
allowUpdating: true,
allowDeleting: true,
confirmDelete: true,
allowDetail: false,
@ -87,7 +87,7 @@ const step2ValidationSchema = Yup.object().shape({
isBranch: Yup.boolean(),
isOrganizationUnit: Yup.boolean(),
allowAdding: Yup.boolean(),
allowEditing: Yup.boolean(),
allowUpdating: Yup.boolean(),
allowDeleting: Yup.boolean(),
confirmDelete: Yup.boolean(),
})

View file

@ -175,7 +175,7 @@ function TreeNode({
className={`text-xs shrink-0 ${isSelected ? 'text-indigo-200' : 'text-gray-400'}`}
onClick={() => !isEditing && onSelect(node.code)}
>
{translate('::' + node.code)}
{translate('::' + node.displayName)}
</span>
{isEditing ? (

View file

@ -362,11 +362,11 @@ const WizardStep2 = ({
</FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.AllowEditing')}
invalid={!!(errors.allowEditing && touched.allowEditing)}
errorMessage={errors.allowEditing}
label={translate('::ListForms.ListFormEdit.AllowUpdating')}
invalid={!!(errors.allowUpdating && touched.allowUpdating)}
errorMessage={errors.allowUpdating}
>
<Field type="checkbox" autoComplete="off" name="allowEditing" component={Checkbox} />
<Field type="checkbox" autoComplete="off" name="allowUpdating" component={Checkbox} />
</FormItem>
<FormItem

View file

@ -1,4 +1,4 @@
import { Alert, Notification, Tabs, toast } from '@/components/ui'
import { Alert, Badge, Notification, Tabs, toast } from '@/components/ui'
import TabContent from '@/components/ui/Tabs/TabContent'
import TabList from '@/components/ui/Tabs/TabList'
import TabNav from '@/components/ui/Tabs/TabNav'
@ -178,20 +178,20 @@ const FormEdit = () => {
title={`${listFormCode} - ${translate(`::${listFormValues.title}`)}`}
defaultTitle={APP_NAME}
></Helmet>
<div className="lg:flex items-center justify-between mb-4 gap-3">
<div className="mb-4 lg:mb-0">
<h4>
<Link to={ROUTES_ENUM.protected.admin.list.replace(':listFormCode', listFormCode)}>
🔙 {listFormCode} - {translate(`::${listFormValues.title}`)}
</Link>
</h4>
{listFormValues.isTenant && (
<Alert showIcon className="my-2" type="warning">
Bu bir MULTI TENANT form'dur, veri kaybı olmaması için, sorgularda TENANTID
parametresini kullanmayı unutmayınız.
</Alert>
)}
</div>
<div className="flex items-center justify-between mb-2 gap-3">
{/* SOL TARAF */}
<h4 className="mb-0">
<Link to={ROUTES_ENUM.protected.admin.list.replace(':listFormCode', listFormCode)}>
🔙 {listFormCode} - {translate(`::${listFormValues.title}`)}
</Link>
</h4>
{/* SAĞ TARAF */}
{listFormValues.isTenant && (
<Badge className='font-semibold' content="Bu bir MULTI TENANT form'dur, veri kaybı olmaması için, sorgularda TENANTID
parametresini kullanmayı unutmayınız." innerClass="p-1 bg-red-50 text-red-500">
</Badge>
)}
</div>
<Tabs defaultValue="details" variant="pill">
<TabList className="flex-wrap border-b mb-2 bg-slate-50">

View file

@ -73,16 +73,16 @@ function FormTabEdit(props: FormEditProps & { listFormCode: string }) {
/>
</FormItem>
<FormItem
label={translate('::ListForms.ListFormEdit.AllowEditing')}
label={translate('::ListForms.ListFormEdit.AllowUpdating')}
invalid={
errors.editingOptionDto?.allowEditing &&
touched.editingOptionDto?.allowEditing
errors.editingOptionDto?.allowUpdating &&
touched.editingOptionDto?.allowUpdating
}
errorMessage={errors.editingOptionDto?.allowEditing}
errorMessage={errors.editingOptionDto?.allowUpdating}
>
<Field
name="editingOptionDto.allowEditing"
placeholder={translate('::ListForms.ListFormEdit.AllowEditing')}
name="editingOptionDto.allowUpdating"
placeholder={translate('::ListForms.ListFormEdit.AllowUpdating')}
component={Checkbox}
/>
</FormItem>

View file

@ -18,6 +18,7 @@ const schema = object().shape({
visible: bool().required(),
allowSearch: bool().required(),
allowEditing: bool().required(),
allowAdding: bool().required(),
})
function FormFieldTabOptions({
@ -104,6 +105,9 @@ function FormFieldTabOptions({
<FormItem label={translate('::ListForms.ListFormEdit.AllowEditing')}>
<Field name="allowEditing" component={Checkbox} />
</FormItem>
<FormItem label={translate('::ListForms.ListFormEdit.AllowAdding')}>
<Field name="allowAdding" component={Checkbox} />
</FormItem>
<Button block variant="solid" loading={isSubmitting} type="submit">
{isSubmitting ? translate('::SavingWithThreeDot') : translate('::Save')}

View file

@ -155,7 +155,11 @@ const FormDevExpress = (props: {
colSpan={formGroupItem.colSpan}
caption={formGroupItem.caption}
>
{(formGroupItem.items as SimpleItemWithColData[])?.map((formItem, i) => {
{(formGroupItem.items as SimpleItemWithColData[])?.filter((formItem) => {
if (mode === 'edit') return formItem.allowEditing !== false
if (mode === 'new') return formItem.allowAdding !== false
return true
}).map((formItem, i) => {
return formItem.editorType2 === PlatformEditorTypes.dxTagBox ? (
<SimpleItemDx
cssClass="font-semibold"

View file

@ -19,6 +19,8 @@ export type SimpleItemWithColData = Overwrite<
canCreate: boolean
canUpdate: boolean
canExport: boolean
allowEditing: boolean
allowAdding: boolean
editorType2: EditorType2
editorScript?: string
}

View file

@ -181,7 +181,7 @@ const useGridData = (props: {
checkPermission(gridDto?.gridOptions.permissionDto.c),
r: checkPermission(gridDto?.gridOptions.permissionDto.r),
u:
gridDto?.gridOptions.editingOptionDto.allowEditing === true &&
gridDto?.gridOptions.editingOptionDto.allowUpdating === true &&
checkPermission(gridDto?.gridOptions.permissionDto.u),
d:
gridDto?.gridOptions.editingOptionDto.allowDeleting === true &&
@ -243,6 +243,12 @@ const useGridData = (props: {
canExport:
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)?.canExport ??
false,
allowEditing:
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)
?.allowEditing ?? true,
allowAdding:
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)
?.allowAdding ?? true,
dataField: i.dataField,
name: i.dataField,
editorType2: i.editorType2,
@ -278,11 +284,11 @@ const useGridData = (props: {
})
.filter((a: any) => {
if (mode === 'view') {
return a.canRead
return a.canRead && a.allowEditing
} else if (mode === 'new') {
return a.canCreate || a.canRead
return (a.canCreate || a.canRead) && a.allowAdding
} else if (mode === 'edit') {
return a.canUpdate || a.canRead
return (a.canUpdate || a.canRead) && a.allowEditing
} else {
return false
}

View file

@ -284,7 +284,7 @@ const GanttView = (props: GanttViewProps) => {
<Item location="after" widget="dxButton" options={getSettingButtonOptions()} />
)}
</Toolbar>
<Editing
enabled={gridDto.gridOptions.ganttOptionDto?.allowEditing}
allowTaskAdding={gridDto.gridOptions.ganttOptionDto?.allowTaskAdding}

View file

@ -73,7 +73,6 @@ import { useListFormCustomDataSource } from './useListFormCustomDataSource'
import { useListFormColumns } from './useListFormColumns'
import { Loading } from '@/components/shared'
import { useStoreState } from '@/store'
import { placeholder } from '@babel/types'
interface GridProps {
listFormCode: string
@ -950,6 +949,8 @@ const Grid = (props: GridProps) => {
canUpdate: listFormField?.canUpdate ?? false,
canCreate: listFormField?.canCreate ?? false,
canExport: listFormField?.canExport ?? false,
allowEditing: listFormField?.allowEditing ?? true,
allowAdding: listFormField?.allowAdding ?? true,
dataField: i.dataField,
name: i.dataField,
editorType2: i.editorType2,
@ -1197,7 +1198,7 @@ const Grid = (props: GridProps) => {
refreshMode={gridDto.gridOptions.editingOptionDto?.refreshMode}
mode={smaller.md ? 'form' : gridDto.gridOptions.editingOptionDto?.mode}
allowDeleting={gridDto.gridOptions.editingOptionDto?.allowDeleting}
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowEditing}
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowUpdating}
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding}
useIcons={gridDto.gridOptions.editingOptionDto?.useIcons}
confirmDelete={gridDto.gridOptions.editingOptionDto?.confirmDelete}
@ -1307,9 +1308,9 @@ const Grid = (props: GridProps) => {
if (mode === 'view') {
return a.canRead
} else if (mode === 'new') {
return a.canCreate || a.canRead
return (a.canCreate || a.canRead) && a.allowAdding
} else if (mode === 'edit') {
return a.canUpdate || a.canRead
return (a.canUpdate || a.canRead) && a.allowEditing
} else {
return false
}
@ -1336,9 +1337,9 @@ const Grid = (props: GridProps) => {
if (mode === 'view') {
return a.canRead
} else if (mode === 'new') {
return a.canCreate || a.canRead
return (a.canCreate || a.canRead) && a.allowAdding
} else if (mode === 'edit') {
return a.canUpdate || a.canRead
return (a.canUpdate || a.canRead) && a.allowEditing
} else {
return false
}

View file

@ -902,7 +902,7 @@ const Tree = (props: TreeProps) => {
refreshMode={gridDto.gridOptions.editingOptionDto?.refreshMode}
mode={smaller.md ? 'form' : gridDto.gridOptions.editingOptionDto?.mode}
allowDeleting={gridDto.gridOptions.editingOptionDto?.allowDeleting}
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowEditing}
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowUpdating}
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding}
useIcons={gridDto.gridOptions.editingOptionDto?.useIcons}
confirmDelete={gridDto.gridOptions.editingOptionDto?.confirmDelete}

View file

@ -317,8 +317,12 @@ const useListFormColumns = ({
return
}
const hasCreate =
gridDto.gridOptions.editingOptionDto.allowAdding &&
checkPermission(gridDto.gridOptions.permissionDto.i)
const hasUpdate =
gridDto.gridOptions.editingOptionDto.allowEditing &&
gridDto.gridOptions.editingOptionDto.allowUpdating &&
checkPermission(gridDto.gridOptions.permissionDto.u)
const hasDelete =
@ -336,7 +340,7 @@ const useListFormColumns = ({
const hasCommandButtons = gridDto.gridOptions.commandColumnDto.length > 0
// Eğer hiçbir buton eklenecek durumda değilse: çık
if (!hasUpdate && !hasDelete && !hasCommandButtons) {
if (!hasUpdate && !hasDelete && !hasCreate && !hasCommandButtons) {
return
}

View file

@ -328,7 +328,7 @@ const useToolbar = ({
// batch editing icin kaydet ve geri al butonu
if (
grdOpt.editingOptionDto?.allowEditing &&
grdOpt.editingOptionDto?.allowUpdating &&
grdOpt.editingOptionDto?.mode == 'batch' &&
checkPermission(grdOpt.permissionDto?.u)
) {