<div class="row detail fullheight" data-ng-controller="AcceptanceDetailCtrl as acceptance">


    <div class="col-lg-8 col-md-8 col-sm-7 fullheight">

        <div class="row detail-top-bar">
            <div class="col-sm-12 fullheight">
                <div class="panel panel-default fullheight shadow-0 bg-primary">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-sm-8">
                                <h1>
                                    <span data-in-place-edit
                                          data-api-id="acceptance.acceptance.id"
                                          data-api-name="'acceptance'"
                                          data-ipe-key="'name'"
                                          data-ipe-value="acceptance.acceptance.name"
                                          data-ipe-name="'global.name'|translate"
                                          data-ipe-deletable="false"
                                            ></span>
                                </h1>
                            </div>
                            <div class="col-sm-4 text-right">
                                <span data-in-place-edit
                                      data-ipe-key="'refnumber'"
                                      data-ipe-value="acceptance.acceptance.refnumber"
                                      data-ipe-deletable="false"
                                      data-api-id="acceptance.acceptance.id"
                                      data-api-name="'acceptance'"
                                      data-ipe-name="'acceptances.refnumber'|translate"></span>
                            </div>
                        </div>
                        {{acceptance.acceptance.state|amaStates:'acceptance'|translate}}
                        <div class="detail-inline">
                            <i class="md md-folder"></i> <a data-ui-sref="app.projectDetail({id: acceptance.acceptance.project.id})">{{acceptance.acceptance.project.name}}</a>
                        </div>
                        <div class="detail-inline detail-inline-date">
                            <i class="md md-schedule"></i>
                            <div class="date-container">
                                <span data-ng-if="acceptance.acceptance.state < 2"
                                      data-in-place-edit
                                      data-api-id="acceptance.acceptance.id"
                                      data-api-name="'acceptance'"
                                      data-ipe-key="'date'"
                                      data-ipe-value="acceptance.acceptance.date"
                                      data-ipe-name="'global.date'|translate"
                                      data-ipe-deletable="false"
                                      data-ipe-type="'date'"
                                      data-output-value="acceptance.acceptance.date|amaDate:'dd.MM.yyyy'"
                                        ></span>
                                <span data-ng-if="acceptance.acceptance.state >= 2">{{acceptance.acceptance.date|amaDate:'dd.MM.yyyy'}}</span>
                            </div>
                        </div>
                        <div class="delete-document">
                            <button class="btn btn-warning btn-icon-round btn-link" title="{{'global.transformTo'|translate}}" data-ng-click="acceptance.nextStep()"><i class="md md-content-copy"></i></button>
                            <button class="btn btn-danger btn-icon-round btn-link" title="{{'acceptance.deleteAcceptance'|translate}}" data-ng-click="acceptance.deleteAcceptance()"><i class="md md-delete"></i></button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="under-detail-top-bar next-fullheight">
            <div data-master-detail
                 data-master-list="acceptance.acceptance.items"
                 data-master-tpl="'templates/pages/items/master.html'"
                 data-detail-tpl="'templates/pages/items/detail.html'"
                 data-detail="acceptance.acceptance.items[0]"
                 data-master-loaded="acceptance.loaded"></div>
        </div>

    </div>


    <div class="col-lg-4 col-md-4 col-sm-5 fullheight">

        <div class="panel panel-default fixedheight-320 shadow-1">
            <div class="panel-body">

                <div class="margin-bottom-lg" data-payment-stats="acceptance.acceptance.costs"></div>

                <div class="row">
                    <div class="col-sm-4">
                        <a class="btn btn-block btn-info" data-ng-if="acceptance.acceptance.state <= 1" data-ng-click="acceptance.viewPdf($event,true)" data-ng-href="{{$root.linkurl}}/api/?action=pdfgen&for=acceptance&forid={{acceptance.acceptance.id}}">{{'pdf.preview'|translate}}</a>
                        <button class="btn btn-block btn-success" data-ng-if="acceptance.acceptance.state <= 1" data-ng-click="acceptance.viewPdf($event,false)">{{'pdf.generate'|translate}}</button>
                        <a class="btn btn-block btn-info" data-ng-if="acceptance.acceptance.state > 1" data-ng-click="acceptance.viewPdf($event,false,acceptance.acceptance.path)" data-ng-href="{{$root.linkurl}}/api/?action=protectedpdf&path={{acceptance.acceptance.path}}">{{'pdf.view'|translate}}</a>
                        <button disabled class="btn btn-block btn-success disabled" data-ng-if="acceptance.acceptance.state > 1">{{'pdf.generated'|translate}}</button>
                    </div>
                    <div class="col-sm-4" data-ng-if="acceptance.acceptance.state >= 1">
                        <a class="btn btn-block btn-info" data-ng-click="acceptance.openMailPreview($event)" data-ng-href="{{$root.linkurl}}/api/?action=pdfgen&for=acceptance&forid={{acceptance.acceptance.id}}">{{'mail.preview'|translate}}</a>
                        <button data-ng-if="acceptance.acceptance.state == 1" class="btn btn-block btn-success" data-ng-click="acceptance.send()">{{'acceptance.send'|translate}}</button>
                        <button disabled data-ng-if="acceptance.acceptance.state > 1" class="btn btn-block btn-success disabled">{{'acceptance.sent' | translate}}</button>
                    </div>
                    <div class="col-sm-4" data-ng-if="acceptance.acceptance.state >= 2">
                        <button data-ng-if="acceptance.acceptance.state == 2" class="btn btn-block btn-danger" data-ng-click="acceptance.decline()">{{'acceptance.decline' |translate}}</button>
                        <button data-ng-if="acceptance.acceptance.state == 2" class="btn btn-block btn-success" data-ng-click="acceptance.accept()">{{'acceptance.accept'|translate}}</button>
                        <button data-ng-if="acceptance.acceptance.state == 3" class="btn btn-block btn-danger" data-ng-click="acceptance.decline()">{{'acceptance.notAccepted' |translate}}</button>
                        <button data-ng-if="acceptance.acceptance.state == 3" class="btn btn-block btn-success" data-ng-click="acceptance.nextStep()">{{'acceptance.nextStep'|translate}}</button>
                    </div>
                </div>
            </div>
        </div>


        <div class="panel panel-default under-fixedheight-320">
            <div class="panel-heading">
                <div class="slideanim-buttons slideanim3-buttons btn-group-sm pull-right" data-ng-init="acceptance.showPage = 1">
                    <button class="btn btn-link ng-binding" data-ng-class="{active: acceptance.showPage==1}" data-ng-click="acceptance.showPage = 1"><i class="md md-lg md-person"></i> {{'clients.client' | translate}}</button>
                    <button class="btn btn-link ng-binding" data-ng-class="{active: acceptance.showPage==2}" data-ng-click="acceptance.showPage = 2"><i class="md md-lg md-comment"></i> {{'acceptance.description' | translate}}</button>
                    <button class="btn btn-link ng-binding" data-ng-class="{active: acceptance.showPage==3}" data-ng-click="acceptance.showPage = 3"><i class="md md-lg md-mail"></i> {{'mail.mailtext' | translate}}</button>
                </div>
            </div>
            <div class="panel-body nopadding nooverflow">
                <div class="slideanim3 fullheight" data-ng-class="{panel2: acceptance.showPage==2, panel3: acceptance.showPage==3}">

                    <div class="slideanim-item fullheight scroll-y">

                        <div data-client-box="acceptance.acceptance.project.client"></div>

                    </div>

                    <div class="slideanim-item fullheight scroll-y">

                        <div class="ipe-wysiwyg-fullheight">
                            <p data-in-place-edit
                               data-api-id="acceptance.acceptance.id"
                               data-api-name="'acceptance'"
                               data-ipe-key="'description'"
                               data-ipe-value="acceptance.acceptance.description"
                               data-ipe-name="'global.description'|translate"
                               data-ipe-type="'wysiwyg'"></p>
                        </div>

                    </div>

                    <div class="slideanim-item nopadding fullheight">

                        <div class="wysiwyg-fullheight">
                            <div data-material-input
                                 data-ng-model="mailtext"
                                 data-input-id="mailtext"
                                 data-input-label="'mail.mailtext'|translate"
                                 data-input-type="wysiwyg"></div>
                        </div>

                    </div>

                </div>
            </div>
        </div>

    </div>


</div>