<commit_before>'use strict',

angular.module('coordinatorentoolControllers').controller('OpdrachtController', ["OpdrachtResource", "$uibModal",
function(Opdracht, $uibModal) {
    Opdracht.query(
        (success) => {
            this.opdrachten = success;
        }
    );

    this.createOpdrachtModal = (updateMode, opdracht) => {
        return {
            templateUrl: "partials/modals/create-opdracht.html",
            controller: "CreateOpdrachtController",
            controllerAs: "copdCtrl",
            keyboard: false,
            resolve: {
                updateMode: () => updateMode,
                opdracht: () => angular.copy(opdracht)
            }
        }
    }

    this.createConfirmModal = (title, body) => {
        return {
            templateUrl: "partials/modals/confirm.html",
            controller:   "ConfirmModalController",
            controllerAs: "cmCtrl",
            keyboard: false,
            resolve: {
                title:() => title,
                body: () => body
            }
        }
    }
    this.deleteOpdracht = (opdrachtId)=> {
        var index = undefined;
        var opdrachtToDelete = this.opdrachten.filter((opdracht, i)=>{
            if(opdracht.id == opdrachtId) {index = i}
            return opdracht.id == opdrachtId;
        });
        $uibModal.open(this.createConfirmModal("Opdracht verwijderen","Ben je zeker dat je opdracht"+ opdrachtToDelete[0].projectCode+ "wilt verwijderen?")).result.then(
            (success) => {
                Opdracht.delete(
                    {id: opdrachtToDelete[0].id},
                    (successResult) => {
                        this.opdrachten.splice(index,1)
                    },
                    (errorResult) =>{

                    }
                );
            },
            (error) => {
                console.log("Opdracht verwijderen werd niet uigevoert!")
            }
        )
    }
    this.createNewOpdracht = () =>{
        $uibModal.open(this.createOpdrachtModal(false, null)).result.then(
            (opdracht)=> {
                Opdracht.save(
                    opdracht,
                    (successResult)=> {
                        console.log("Opdracht was saved! Result is %o", successResult);
                        this.opdrachten.push(successResult);
                    },
                    (errorResult) => {<commit_msg>Fixed body of opdracht delete modal<commit_after>'use strict',

angular.module('coordinatorentoolControllers').controller('OpdrachtController', ["OpdrachtResource", "$uibModal",
function(Opdracht, $uibModal) {
    Opdracht.query(
        (success) => {
            this.opdrachten = success;
        }
    );

    this.createOpdrachtModal = (updateMode, opdracht) => {
        return {
            templateUrl: "partials/modals/create-opdracht.html",
            controller: "CreateOpdrachtController",
            controllerAs: "copdCtrl",
            keyboard: false,
            resolve: {
                updateMode: () => updateMode,
                opdracht: () => angular.copy(opdracht)
            }
        }
    }

    this.createConfirmModal = (title, body) => {
        return {
            templateUrl: "partials/modals/confirm.html",
            controller:   "ConfirmModalController",
            controllerAs: "cmCtrl",
            keyboard: false,
            resolve: {
                title:() => title,
                body: () => body
            }
        }
    }
    this.deleteOpdracht = (opdrachtId)=> {
        var index = undefined;
        var opdrachtToDelete = this.opdrachten.filter((opdracht, i)=>{
            if(opdracht.id == opdrachtId) {index = i}
            return opdracht.id == opdrachtId;
        });
        $uibModal.open(this.createConfirmModal("Opdracht verwijderen","Ben je zeker dat je de opdracht bij "+ opdrachtToDelete[0].klant+ " wil verwijderen?")).result.then(
            (success) => {
                Opdracht.delete(
                    {id: opdrachtToDelete[0].id},
                    (successResult) => {
                        this.opdrachten.splice(index,1)
                    },
                    (errorResult) =>{

                    }
                );
            },
            (error) => {
                console.log("Opdracht verwijderen werd niet uigevoert!")
            }
        )
    }
    this.createNewOpdracht = () =>{
        $uibModal.open(this.createOpdrachtModal(false, null)).result.then(
            (opdracht)=> {
                Opdracht.save(
                    opdracht,
                    (successResult)=> {
                        console.log("Opdracht was saved! Result is %o", successResult);
                        this.opdrachten.push(successResult);
                    },
                    (errorResult) => {
{'fraction_non_alphanumeric': 0.12016632016632017, 'fraction_numerical': 0.0012474012474012475, 'mean_word_length': 1.508342022940563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4724135', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1334, 'n_words': 207}