<template>
    <v-sheet tile>
        <template v-if="action != 'delete'">
            <registru-row-input-column 
                v-for="(column, index) in registru.columns"
                :key="'column-' + index"
                :app="app"
                :column="column"
                :rowvalues="activeRecord.rowvalues"
                class="mb-1"
                @update-values="OnUpdateRowvalues"
            />
        </template>

        <cs-info-alert 
            v-else
            color="red"
            icon="mdi-alert"
            :message="__('Doriți ștergerea rândului selectat?')"
        />
    </v-sheet>
</template>

<script>
    export default {

        props: {
            controls: {default: () => ({})},
            activeRecord: {required: true},
            errorsManager: {required: true},
            action: {required: true},
            currentAction: {required: true},
            app: {required: true},
        },

        computed: {
            controller() {
                return this.app.classes.Customerregistru;
            },

            activeRegistru() {
                return this.controller.activeRegistru
            },

            registru() {
                return this.activeRegistru.props.registru;
            }
        },

        methods: {
            OnUpdateRowvalues(rowvalues) {
                _.each(rowvalues, (value, key) => {
                    this.activeRecord.rowvalues[key] = value;
                })
            }
        },

        mounted() {
            if(this.action != 'delete')
            {

            }    
        },

        components: {
            CsInfoAlert: require('@CsVueComp/sheets/CsInfoAlert').default,
        },

        name: 'CustomerRegisterRowInput',
    }
</script>