Allow Updating -> Allow Editing ve Allow Detail eklendi.
This commit is contained in:
parent
b43fb07e5b
commit
758d87c983
16 changed files with 282 additions and 216 deletions
|
|
@ -13,7 +13,8 @@ public class GridEditingDto
|
|||
/// <summary>Accepted Values: 'full' | 'reshape' | 'repaint'
|
||||
/// </summary>
|
||||
public string RefreshMode { get; set; } = "full";
|
||||
public bool AllowUpdating { get; set; } = false;
|
||||
public bool AllowEditing { get; set; } = false;
|
||||
public bool AllowDetail { get; set; } = false;
|
||||
public bool AllowDeleting { get; set; } = false;
|
||||
public bool AllowAllDeleting { get; set; } = false;
|
||||
public bool AllowAdding { get; set; } = false;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class SchedulerOptionDto
|
|||
/// <summary>
|
||||
/// Etkinlik güncellemeye izin verilip verilmediğini belirtir
|
||||
/// </summary>
|
||||
public bool AllowUpdating { get; set; } = false;
|
||||
public bool AllowEditing { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Etkinlik eklemeye izin verilip verilmediğini belirtir
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -3998,10 +3998,16 @@
|
|||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "ListForms.ListFormEdit.EditingAllowUpdating",
|
||||
"key": "ListForms.ListFormEdit.EditingAllowEditing",
|
||||
"en": "Allow Editing",
|
||||
"tr": "Güncellemeye İzin Ver"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "ListForms.ListFormEdit.EditingAllowDetail",
|
||||
"en": "Allow Detail",
|
||||
"tr": "Detaya İzin Ver"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "ListForms.ListFormEdit.EditingAllowDeleting",
|
||||
|
|
@ -10118,9 +10124,9 @@
|
|||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "ListForms.SchedulerOptions.AllowUpdating",
|
||||
"key": "ListForms.SchedulerOptions.AllowEditing",
|
||||
"tr": "Güncellemeye İzin Ver",
|
||||
"en": "Allow Updating"
|
||||
"en": "Allow Editing"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
|
|
@ -10200,6 +10206,12 @@
|
|||
"tr": "Düzenle",
|
||||
"en": "Edit"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "App.Platform.Detail",
|
||||
"tr": "Detay",
|
||||
"en": "Detail"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "App.Platform.Delete",
|
||||
|
|
|
|||
|
|
@ -1153,8 +1153,8 @@ public class ListFormSeeder_Crm : IDataSeedContributor, ITransientDependency
|
|||
{
|
||||
Order = 3, Caption="Supply Card", ColCount = 3, ColSpan = 2, ItemType = "group", Items =
|
||||
[
|
||||
new EditingFormItemDto { Order = 22, DataField = "CustomerTypeId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 23, DataField = "CustomerSegmentId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 22, DataField = "CustomerTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 23, DataField = "CustomerSegmentId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 24, DataField = "EmployeeId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 25, DataField = "TeamCode", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 26, DataField = "TotalRevenue", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat() },
|
||||
|
|
@ -3321,7 +3321,7 @@ public class ListFormSeeder_Crm : IDataSeedContributor, ITransientDependency
|
|||
new EditingFormItemDto { Order = 10, DataField="ExchangeRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat() },
|
||||
new EditingFormItemDto { Order = 11, DataField="DiscountRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat() },
|
||||
new EditingFormItemDto { Order = 12, DataField="TaxRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat() },
|
||||
new EditingFormItemDto { Order = 13, DataField="SpecialInstructions", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
|
||||
new EditingFormItemDto { Order = 13, DataField="SpecialInstructions", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 14, DataField="Notes", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
|
||||
]}
|
||||
}),
|
||||
|
|
@ -3336,8 +3336,8 @@ public class ListFormSeeder_Crm : IDataSeedContributor, ITransientDependency
|
|||
}),
|
||||
CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] {
|
||||
new() {
|
||||
Hint = "Manage",
|
||||
Text ="Manage",
|
||||
Hint = "Items",
|
||||
Text ="Items",
|
||||
UrlTarget="_blank",
|
||||
AuthName = listFormName,
|
||||
Url=$"/admin/form/{SeederUtils.GetDefaultFormCodes(listFormName)}/@Id",
|
||||
|
|
|
|||
|
|
@ -2859,7 +2859,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend
|
|||
AllowResizing = true,
|
||||
AllowDragging = true,
|
||||
AllowDeleting = true,
|
||||
AllowUpdating = true,
|
||||
AllowEditing = true,
|
||||
AllowAdding = true,
|
||||
}),
|
||||
CultureName = LanguageCodes.En,
|
||||
|
|
|
|||
|
|
@ -35,16 +35,18 @@ public static class SeederDefaults
|
|||
int Height,
|
||||
bool AllowDeleting,
|
||||
bool AllowAdding,
|
||||
bool AllowUpdating,
|
||||
bool AllowEditing,
|
||||
bool ConfirmDelete,
|
||||
bool SendOnlyChangedFormValuesUpdate) => JsonSerializer.Serialize(new GridEditingDto
|
||||
bool SendOnlyChangedFormValuesUpdate,
|
||||
bool AllowDetail = false) => JsonSerializer.Serialize(new GridEditingDto
|
||||
{
|
||||
Popup = new GridEditingPopupDto() { Title = Title, Width = Width, Height = Height },
|
||||
AllowDeleting = AllowDeleting,
|
||||
AllowAdding = AllowAdding,
|
||||
AllowUpdating = AllowUpdating,
|
||||
AllowEditing = AllowEditing,
|
||||
ConfirmDelete = ConfirmDelete,
|
||||
SendOnlyChangedFormValuesUpdate = SendOnlyChangedFormValuesUpdate
|
||||
SendOnlyChangedFormValuesUpdate = SendOnlyChangedFormValuesUpdate,
|
||||
AllowDetail = AllowDetail
|
||||
});
|
||||
|
||||
public static readonly string DefaultFilterJson = "\"IsDeleted\" = 'false'";
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ export interface SchedulerOptionDto {
|
|||
allowResizing?: boolean
|
||||
allowDragging?: boolean
|
||||
allowDeleting?: boolean
|
||||
allowUpdating?: boolean
|
||||
allowEditing?: boolean
|
||||
allowAdding?: boolean
|
||||
resources?: SchedulerResourceDto[]
|
||||
}
|
||||
|
|
@ -444,7 +444,8 @@ export interface SchedulerResourceDto {
|
|||
export interface GridEditingDto {
|
||||
mode?: GridsEditMode
|
||||
refreshMode?: GridsEditRefreshMode
|
||||
allowUpdating: boolean
|
||||
allowEditing: boolean
|
||||
allowDetail: boolean
|
||||
allowDeleting: boolean
|
||||
allowAllDeleting: boolean
|
||||
allowAdding: boolean
|
||||
|
|
|
|||
|
|
@ -55,18 +55,33 @@ function FormTabEdit(props: FormEditProps & { listFormCode: string }) {
|
|||
/>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label={translate('::ListForms.ListFormEdit.EditingAllowUpdating')}
|
||||
label={translate('::ListForms.ListFormEdit.EditingAllowEditing')}
|
||||
invalid={
|
||||
errors.editingOptionDto?.allowUpdating && touched.editingOptionDto?.allowUpdating
|
||||
errors.editingOptionDto?.allowEditing && touched.editingOptionDto?.allowEditing
|
||||
}
|
||||
errorMessage={errors.editingOptionDto?.allowUpdating}
|
||||
errorMessage={errors.editingOptionDto?.allowEditing}
|
||||
>
|
||||
<Field
|
||||
name="editingOptionDto.allowUpdating"
|
||||
placeholder={translate('::ListForms.ListFormEdit.EditingAllowUpdating')}
|
||||
name="editingOptionDto.allowEditing"
|
||||
placeholder={translate('::ListForms.ListFormEdit.EditingAllowEditing')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label={translate('::ListForms.ListFormEdit.EditingAllowDetail')}
|
||||
invalid={
|
||||
errors.editingOptionDto?.allowDetail && touched.editingOptionDto?.allowDetail
|
||||
}
|
||||
errorMessage={errors.editingOptionDto?.allowDetail}
|
||||
>
|
||||
<Field
|
||||
name="editingOptionDto.allowDetail"
|
||||
placeholder={translate('::ListForms.ListFormEdit.EditingAllowDetail')}
|
||||
component={Checkbox}
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label={translate('::ListForms.ListFormEdit.EditingAllowDeleting')}
|
||||
invalid={
|
||||
|
|
|
|||
|
|
@ -354,8 +354,8 @@ function FormTabScheduler(props: FormEditProps) {
|
|||
<Field name="schedulerOptionDto.allowAdding" component={Checkbox} />
|
||||
</FormItem>
|
||||
|
||||
<FormItem label={translate('::ListForms.SchedulerOptions.AllowUpdating')}>
|
||||
<Field name="schedulerOptionDto.allowUpdating" component={Checkbox} />
|
||||
<FormItem label={translate('::ListForms.SchedulerOptions.AllowEditing')}>
|
||||
<Field name="schedulerOptionDto.allowEditing" component={Checkbox} />
|
||||
</FormItem>
|
||||
|
||||
<FormItem label={translate('::ListForms.SchedulerOptions.AllowDeleting')}>
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ function FormFieldTabOptions({
|
|||
>
|
||||
<Field name="visible" component={Checkbox} />
|
||||
</FormItem>
|
||||
<FormItem label={translate('::ListForms.ListFormEdit.EditingAllowUpdating')}>
|
||||
<FormItem label={translate('::ListForms.ListFormEdit.EditingAllowEditing')}>
|
||||
<Field name="columnEditingDto.allowEditing" component={Checkbox} />
|
||||
</FormItem>
|
||||
<FormItem label={translate('::ListForms.ListFormFieldEdit.HeaderingAllowSearch')}>
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ const useGridData = (props: {
|
|||
checkPermission(gridDto?.gridOptions.permissionDto.c),
|
||||
r: checkPermission(gridDto?.gridOptions.permissionDto.r),
|
||||
u:
|
||||
gridDto?.gridOptions.editingOptionDto.allowUpdating === true &&
|
||||
gridDto?.gridOptions.editingOptionDto.allowEditing === true &&
|
||||
checkPermission(gridDto?.gridOptions.permissionDto.u),
|
||||
d:
|
||||
gridDto?.gridOptions.editingOptionDto.allowDeleting === true &&
|
||||
|
|
|
|||
|
|
@ -1151,7 +1151,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?.allowUpdating}
|
||||
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowEditing}
|
||||
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding}
|
||||
useIcons={gridDto.gridOptions.editingOptionDto?.useIcons}
|
||||
confirmDelete={gridDto.gridOptions.editingOptionDto?.confirmDelete}
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
|
||||
<Editing
|
||||
allowAdding={gridDto.gridOptions.schedulerOptionDto?.allowAdding ?? false}
|
||||
allowUpdating={gridDto.gridOptions.schedulerOptionDto?.allowUpdating ?? false}
|
||||
allowUpdating={gridDto.gridOptions.schedulerOptionDto?.allowEditing ?? false}
|
||||
allowDeleting={gridDto.gridOptions.schedulerOptionDto?.allowDeleting ?? false}
|
||||
allowResizing={gridDto.gridOptions.schedulerOptionDto?.allowResizing ?? false}
|
||||
allowDragging={gridDto.gridOptions.schedulerOptionDto?.allowDragging ?? false}
|
||||
|
|
|
|||
|
|
@ -865,7 +865,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?.allowUpdating}
|
||||
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowEditing}
|
||||
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding}
|
||||
useIcons={gridDto.gridOptions.editingOptionDto?.useIcons}
|
||||
confirmDelete={gridDto.gridOptions.editingOptionDto?.confirmDelete}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { usePWA } from '@/utils/hooks/usePWA'
|
|||
import { useDialogContext } from '../shared/DialogContext'
|
||||
import { dynamicFetch } from '@/services/form.service'
|
||||
import { GridColumnData } from './GridColumnData'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
import {
|
||||
ColumnFormatDto,
|
||||
EditingFormItemDto,
|
||||
|
|
@ -115,14 +116,15 @@ const cachedLoader = (key: string, loader: () => Promise<any[]>) => {
|
|||
const cached = __lookupCache.get(key)
|
||||
|
||||
// Cache'de var ve süresi dolmamışsa kullan
|
||||
if (cached && (now - cached.timestamp) < CACHE_DURATION) {
|
||||
if (cached && now - cached.timestamp < CACHE_DURATION) {
|
||||
return cached.promise
|
||||
}
|
||||
|
||||
// Cache boyutu limitini aşarsa en eskiyi temizle
|
||||
if (__lookupCache.size >= MAX_CACHE_SIZE) {
|
||||
const oldestKey = Array.from(__lookupCache.entries())
|
||||
.sort((a, b) => a[1].timestamp - b[1].timestamp)[0][0]
|
||||
const oldestKey = Array.from(__lookupCache.entries()).sort(
|
||||
(a, b) => a[1].timestamp - b[1].timestamp,
|
||||
)[0][0]
|
||||
__lookupCache.delete(oldestKey)
|
||||
}
|
||||
|
||||
|
|
@ -153,13 +155,15 @@ const useListFormColumns = ({
|
|||
const { translate } = useLocalization()
|
||||
const { checkPermission } = usePermission()
|
||||
const isPwaMode = usePWA()
|
||||
const location = useLocation()
|
||||
|
||||
useEffect(() => {
|
||||
// listFormCode değişince lookup cache temizlensin (farklı form farklı lookuplar)
|
||||
__lookupCache.clear()
|
||||
}, [listFormCode])
|
||||
|
||||
const lookupDataSource = useCallback((options: any, colData: any, listFormCode: string) => {
|
||||
const lookupDataSource = useCallback(
|
||||
(options: any, colData: any, listFormCode: string) => {
|
||||
const { lookupDto } = colData
|
||||
const filters = []
|
||||
if (lookupDto.cascadeParentFields) {
|
||||
|
|
@ -201,7 +205,9 @@ const useListFormColumns = ({
|
|||
store: [],
|
||||
}
|
||||
}
|
||||
}, [listFormCode])
|
||||
},
|
||||
[listFormCode],
|
||||
)
|
||||
|
||||
const createLookupStaticDataSource = (
|
||||
load: () => any,
|
||||
|
|
@ -247,7 +253,7 @@ const useListFormColumns = ({
|
|||
name: a.Name,
|
||||
group: a.Group,
|
||||
|
||||
...a
|
||||
...a,
|
||||
}))
|
||||
})
|
||||
} catch (error: any) {
|
||||
|
|
@ -312,13 +318,17 @@ const useListFormColumns = ({
|
|||
}
|
||||
|
||||
const hasUpdate =
|
||||
gridDto.gridOptions.editingOptionDto.allowUpdating &&
|
||||
gridDto.gridOptions.editingOptionDto.allowEditing &&
|
||||
checkPermission(gridDto.gridOptions.permissionDto.u)
|
||||
|
||||
const hasDelete =
|
||||
gridDto.gridOptions.editingOptionDto.allowDeleting &&
|
||||
checkPermission(gridDto.gridOptions.permissionDto.d)
|
||||
|
||||
const hasDetail =
|
||||
gridDto.gridOptions.editingOptionDto.allowDetail &&
|
||||
checkPermission(gridDto.gridOptions.permissionDto.u)
|
||||
|
||||
const hasCommandButtons = gridDto.gridOptions.commandColumnDto.length > 0
|
||||
|
||||
// Eğer hiçbir buton eklenecek durumda değilse: çık
|
||||
|
|
@ -328,17 +338,39 @@ const useListFormColumns = ({
|
|||
|
||||
const buttons: any[] = []
|
||||
|
||||
if (hasDetail) {
|
||||
const item = {
|
||||
name: 'detail',
|
||||
text: translate('::App.Platform.Detail'),
|
||||
onClick: (e: any) => {
|
||||
if (typeof e.event?.preventDefault === 'function') {
|
||||
e.event.preventDefault()
|
||||
}
|
||||
|
||||
if (!gridDto.gridOptions.keyFieldName) return
|
||||
|
||||
const url =
|
||||
location.pathname?.replace('/list/', '/form/') +
|
||||
`/${e.row.data[gridDto.gridOptions.keyFieldName]}`
|
||||
|
||||
window.open(url, isPwaMode ? '_self' : '_blank')
|
||||
},
|
||||
}
|
||||
|
||||
buttons.push(item)
|
||||
}
|
||||
|
||||
if (hasUpdate) {
|
||||
buttons.push({
|
||||
name: 'edit',
|
||||
text: translate('::App.Platform.Edit')
|
||||
text: translate('::App.Platform.Edit'),
|
||||
})
|
||||
}
|
||||
|
||||
if (hasDelete) {
|
||||
buttons.push({
|
||||
name: 'delete',
|
||||
text: translate('::App.Platform.Delete')
|
||||
text: translate('::App.Platform.Delete'),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -418,7 +450,8 @@ const useListFormColumns = ({
|
|||
return column as GridColumnData
|
||||
}, [gridDto, checkPermission, translate, listFormCode, isPwaMode, dialog, gridRef])
|
||||
|
||||
const getColumns = useCallback((columnFormats: ColumnFormatDto[]) => {
|
||||
const getColumns = useCallback(
|
||||
(columnFormats: ColumnFormatDto[]) => {
|
||||
const columns: GridColumnData[] = []
|
||||
|
||||
if (!gridDto || !columnFormats) {
|
||||
|
|
@ -567,7 +600,9 @@ const useListFormColumns = ({
|
|||
})
|
||||
|
||||
return columns
|
||||
}, [gridDto, lookupDataSource, translate, checkPermission, dialog, isPwaMode, listFormCode])
|
||||
},
|
||||
[gridDto, lookupDataSource, translate, checkPermission, dialog, isPwaMode, listFormCode],
|
||||
)
|
||||
|
||||
const getBandedColumns = useCallback(() => {
|
||||
if (!gridDto) {
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ const useToolbar = ({
|
|||
|
||||
// batch editing icin kaydet ve geri al butonu
|
||||
if (
|
||||
grdOpt.editingOptionDto?.allowUpdating &&
|
||||
grdOpt.editingOptionDto?.allowEditing &&
|
||||
grdOpt.editingOptionDto?.mode == 'batch' &&
|
||||
checkPermission(grdOpt.permissionDto?.u)
|
||||
) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue