archiveModificationForm.html 4.27 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<div class="panel panel-default" id="archiveModificationForm">
    <div class="panel-body">
        <h4>Archive(s)</h4>
        <br/>
        <div class="table-responsive">
            <table class="table table-condensed">
                <tbody>
                    <tr id="selectedArchiveId">
                        <td><strong>Reference</strong></td>
                        <td><span></span></td>
                    </tr>
                    <tr id="selectedArchiveReference">
                        <td><strong>Archive name</strong></td>
                        <td><span></span></td>
                    </tr>
                </tbody>
            </table>
            <?hinclude recordsManagement/archive/archiveModificationModal/accessRule.html?>
            <?hinclude recordsManagement/archive/archiveModificationModal/retentionRule.html?>
Cyril Vazquez's avatar
Cyril Vazquez committed
20
21
            <?hinclude recordsManagement/archive/archiveModificationModal/requestCommunication.html?>
            <?hinclude recordsManagement/archive/archiveModificationModal/archiveTransfer.html?>
22
            <!-- <?hinclude recordsManagement/archive/archiveModificationModal/originatorOrg.html?> -->
23
24
25
        </div>
    </div>
</div>
Cyril Vazquez's avatar
Cyril Vazquez committed
26
27
28
29
30
31
32
33
34
35
36
<?hinclude medona/message/modificationMessageCommentFrom.html ?>

<div class="hide">
    <span id="mtext_requestCommunication">Request of communication</span>
    <span id="mtext_flagForRestitution">Flag for restitution</span>
    <span id="mtext_cancelRestitution">Cancel restitution</span>
    <span id="mtext_validateRestitution">Validate restitution</span>

    <span id="restituable_text">restituable</span>

</div>
37
38

<script>
Cyril Vazquez's avatar
Cyril Vazquez committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

    $('#archiveList').on('click', 'li', function () {
        ExtentionSetting.set();
    });

    var ExtentionSetting = {
        init: false,
        set: function () {
            if (this.init === true)
                return;

            this.init = true;

            // Add new actions
            ModificationModal.actionsList.flagForRestitution = '/restitution/request';
            //ModificationModal.actionsList.cancelRestitution = '/cancelRestitution';
            ModificationModal.actionsList.validateRestitution = '/validateRestitution';
            ModificationModal.actionsList.requestCommunication = '/archiveDelivery';
            ModificationModal.actionsList.flagForTransfer = '/outgoingTransfer/sending';

            // Add new action types
            ModificationModal.actionsType.requestCommunication = "POST";
Cyril Vazquez's avatar
Cyril Vazquez committed
61
            ModificationModal.actionsType.requestModification = "POST";
Cyril Vazquez's avatar
Cyril Vazquez committed
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

            // Add new selection status for multiple selection
            if (ArchivesAction.actions) {
                ArchivesAction.actions.freeze.push('restituable');
                ArchivesAction.actions.flagForDestruction.push('restituable');

                ArchivesAction.actions.flagForRestitution = ['preserved'];
                //ArchivesAction.actions.cancelRestitution = ['restituable'];
                ArchivesAction.actions.validateRestitution = ['retituted'];
                ArchivesAction.actions.requestCommunication = ['frozen', 'preserved', 'restituable', 'disposable'];
            }
        }
    };

    var ArchiveModification = {
        modal: $('#modificationModal'),
        serialize: function (type) {
Alexandre Morin's avatar
Alexandre Morin committed
79
80
            var parameter = {};
            var transaction = false;
Cyril Vazquez's avatar
Cyril Vazquez committed
81

Alexandre Morin's avatar
Alexandre Morin committed
82
            $("#transaction").val() ? transaction = true : transaction = false;
83
            if (type === "accessRule" || type === "retentionRule" || type === "requestCommunication") {
Alexandre Morin's avatar
Alexandre Morin committed
84
                parameter = eval(type+"_serialize()");
Cyril Vazquez's avatar
Cyril Vazquez committed
85
86
87
88
89
90
            } else if (type === "flagForTransfer") {
                if ($('#archivalAgencySelect').find('option:selected').val()) {
                    parameter.archiverOrgRegNumber = $('#archivalAgencySelect').find('option:selected').val();
                }
            }

Alexandre Morin's avatar
Alexandre Morin committed
91
92
93
            if (transaction) {
                parameter.identifier = this.modal.find('[name="identifier"]').val();
                parameter.comment = this.modal.find('[name="comment"]').val();
94
                parameter.format = this.modal.find('[name="format"]').val()
Cyril Vazquez's avatar
Cyril Vazquez committed
95

Alexandre Morin's avatar
Alexandre Morin committed
96
97
98
99
                if (parameter!=-1 && !parameter.comment) {
                    gritter.show($('#empty_text').html(), false);
                    return -1;
                }
Cyril Vazquez's avatar
Cyril Vazquez committed
100
101
            }

102
103
            return parameter;
        }
Alexandre Morin's avatar
Alexandre Morin committed
104
    };
105
</script>