Projekt

Obecné

Profil

« Předchozí | Další » 

Revize fabfbe32

Přidáno uživatelem Jaroslav Hrubý před asi 2 roky(ů)

Refactoring, fixes

Zobrazit rozdíly:

webapp/components/modals/AssignDocumentModal.tsx
13 13
import { getColumnSearchProps, getLocaleProps } from '../../utils/tableUtils';
14 14
import { TableUserInfo } from '../types/TableUserInfo';
15 15
import { TableDocInfo } from '../types/TableDocInfo';
16
import { ABadge, BadgeStyle } from '../common/ABadge';
17
import { ok } from 'assert';
16 18

  
17 19
interface ModalProps {
18
    onCancel: () => void;
20
    onCancel: (ok: boolean) => void;
19 21
    documentsIds: (string | undefined)[];
20 22
}
21 23

  
......
26 28
    const [selectedUsers, setSelectedUsers] = useState<string[]>([]);
27 29

  
28 30
    const handleOk = () => {
29
        onCancel();
31
        onCancel(true);
30 32
    };
31 33

  
32 34
    const handleCancel = () => {
33
        onCancel();
35
        onCancel(false);
34 36
    };
35 37

  
36 38
    async function fetchData() {
......
64 66
                        3000,
65 67
                        'top-end'
66 68
                    );
67
                    onCancel();
69
                    onCancel(true);
68 70
                });
69 71
        }
70 72
    };
......
131 133
            },
132 134
        },
133 135
        {
134
            title: 'Přiřazeno dokumentů',
136
            title: 'Aktivní | Hotovo | Celkem',
135 137
            key: 'docCounts',
136 138
            align: 'center' as 'center',
137 139
            dataIndex: 'assignedDocumentsCount',
138 140
            // @ts-ignore
139
            render: (assignedDocumentsCount) => (
141
            render: (text, row) => (
140 142
                <div>
141
                    <Space size={'middle'}>
142
                        <Badge count={assignedDocumentsCount} />
143
                    </Space>
143
                    <ABadge style={BadgeStyle.WARNING}>
144
                        {row.newDocumentsCount + row.inProgressDocumentsCount}
145
                    </ABadge>
146
                    {' | '}
147
                    <ABadge style={BadgeStyle.SUCCESS}>
148
                        {row.finalizedDocumentsCount}
149
                    </ABadge>
150
                    {' | '}
151
                    <ABadge style={BadgeStyle.GENERAL}>
152
                        {row.finalizedDocumentsCount +
153
                            row.newDocumentsCount +
154
                            row.inProgressDocumentsCount}
155
                    </ABadge>
144 156
                </div>
145 157
            ),
146 158
            // @ts-ignore
147
            sorter: (a, b) => a.assignedDocumentsCount - b.assignedDocumentsCount,
159
            sorter: (a, b) =>
160
                a.newDocumentsCount +
161
                a.inProgressDocumentsCount -
162
                (b.newDocumentsCount + b.inProgressDocumentsCount),
148 163
        },
149 164
    ];
150 165

  
......
154 169
            onOk={handleOk}
155 170
            visible={true}
156 171
            onCancel={handleCancel}
157
            width={1000}
172
            width={1100}
158 173
            footer={[
159 174
                <Button key="back" onClick={handleCancel}>
160 175
                    Storno

Také k dispozici: Unified diff