-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathIndex.js
More file actions
126 lines (116 loc) · 3.62 KB
/
Index.js
File metadata and controls
126 lines (116 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
$(function () {
const l = abp.localization.getResource('GrantManager');
let createModal = new abp.ModalManager(abp.appPath + 'Intakes/CreateModal');
let updateModal = new abp.ModalManager(abp.appPath + 'Intakes/UpdateModal');
/**
* Intakes: List All
*/
$.fn.dataTable.Buttons.defaults.dom.button.className = 'btn flex-none';
let actionButtons = [
{
text: '<i class="fl fl-add-to align-middle"></i> <span>' + l('Common:Command:Create') + '</span>',
titleAttr: l('Common:Command:Create'),
id: 'CreateIntakeButton',
className: 'btn-light rounded-1',
action: (e, dt, node, config) => createIntakeBtn(e)
},
...commonTableActionButtons(l('Intake'))
];
const listColumns = [
{
title: l('Intake'),
name: "intakeName",
data: "intakeName",
index: 0
},
{
title: l('Common:StartDate'),
name: "startDate",
data: "startDate",
index: 1,
render: (data) => luxon
.DateTime
.fromISO(data, {
locale: abp.localization.currentCulture.name
}).toLocaleString(luxon.DateTime.DATE_SHORT)
},
{
title: l('Common:EndDate'),
name: "endDate",
data: "endDate",
index: 2,
render: (data) => luxon
.DateTime
.fromISO(data, {
locale: abp.localization.currentCulture.name
}).toLocaleString(luxon.DateTime.DATE_SHORT)
},
{
title: l("Budget"),
name: "budget",
data: "budget",
index: 3
},
{
title: l('Actions'),
data: 'id',
orderable: false,
className: 'notexport text-center',
name: 'rowActions',
index: 4,
rowAction: {
items:
[
{
text: l('Common:Command:Edit'),
action: (data) => updateModal.open({ id: data.record.id })
}
]
}
}
];
const defaultVisibleColumns = [
'intakeName',
'startDate',
'endDate',
'budget',
'rowActions'
];
let responseCallback = function (result) {
return {
recordsTotal: result.totalCount,
recordsFiltered: result.items.length,
data: result.items
};
};
let dt = $('#IntakesTable');
let dataTable = initializeDataTable({
dt,
defaultVisibleColumns,
listColumns,
maxRowsPerPage: 25,
defaultSortColumn: 0,
dataEndpoint: unity.grantManager.intakes.intake.getList,
data: {},
responseCallback,
actionButtons,
serverSideEnable: false,
pagingEnabled: true,
reorderEnabled: false,
languageSetValues: {},
dataTableName: 'IntakesTable',
dynamicButtonContainerId: 'dynamicButtonContainerId',
useNullPlaceholder: true,
externalSearchId: 'search-intakes'
});
createModal.onResult(function () {
dataTable.ajax.reload();
});
updateModal.onResult(function () {
dataTable.ajax.reload();
});
function createIntakeBtn(e) {
e.preventDefault();
createModal.open();
};
});