<div class="blade-static __bottom" ng-include="'$(Platform)/Scripts/common/templates/ok-cancel2.tpl.html'"></div>
<div class="blade-content __medium-wide">
    <div class="blade-inner">
        <div class="inner-block" ng-controller="virtoCommerce.orderModule.paymentDetailController">
            <div class="order-status" ng-if="blade.currentEntity.status">
                <div class="status" ng-bind="blade.currentEntity.status | settingTranslate:'PaymentIn.Status'"></div>
                <div class="reason" ng-bind="blade.currentEntity.cancelReason" ng-if="blade.currentEntity.isCancelled"></div>
            </div>
            <div class="order-brand" ng-if="!blade.isNew">
                <div class="brand-image" ng-if="blade.currentEntity.paymentMethod">
                    <img class="brand-logo" ng-src="{{blade.currentEntity.paymentMethod.logoUrl}}" alt="" ng-if="blade.currentEntity.paymentMethod.logoUrl">
                </div>
                <div class="brand-t" title="{{blade.currentEntity.paymentMethod ? blade.currentEntity.paymentMethod.description : blade.currentEntity.gatewayCode}}">
                    {{blade.currentEntity.paymentMethod ? blade.currentEntity.paymentMethod.name : blade.currentEntity.gatewayCode}}
                </div>
                <div class="brand-descr" ng-if="blade.currentEntity.paymentMethod && blade.currentEntity.paymentMethod.paymentMethodGroupType">
                    {{blade.currentEntity.paymentMethod.paymentMethodGroupType}}
                </div>
            </div>

            <form class="form" name="detailForm">
                <fieldset ng-disabled="blade.isLocked">
                    <div class="form-group" ng-if="blade.isNew">
                        <label class="form-label">{{ 'orders.blades.payment-detail.labels.payment-gateway' | translate }}</label>
                        <div class="form-input">
                            <ui-select ng-model="blade.currentEntity.paymentMethod" required ng-disabled="blade.isLocked">
                                <ui-select-match placeholder="{{ 'orders.blades.payment-detail.placeholders.payment-gateway' | translate }}">{{$select.selected.name}}</ui-select-match>
                                <ui-select-choices repeat="x in blade.paymentMethods | filter: { name: $select.search }">
                                    <span ng-bind-html="x.name | highlight: $select.search"></span>
                                </ui-select-choices>
                            </ui-select>

                        </div>
                    </div>
                    <div class="form-group" ng-init="setForm(detailForm)">
                        <label class="form-label">{{ 'orders.blades.payment-detail.labels.approved' | translate }}</label>
                        <div class="form-input">
                            <label class="form-label __switch">
                                <input type="checkbox" ng-model="blade.currentEntity.isApproved" />
                                <span class="switch"></span>
                            </label>
                        </div>
                    </div>
                    <va-metaform registered-inputs="blade.metaFields" blade="blade" column-count="2"></va-metaform>

                    <div class="form columns clearfix">
                        <div class="column">
                            <div class="form-group">
                                <va-setting-value-select blade="blade"
                                                         label="'orders.blades.payment-detail.labels.status' | translate"
                                                         placeholder="'orders.blades.payment-detail.placeholders.status' | translate"
                                                         setting="'PaymentIn.Status'"
                                                         ng-model="blade.currentEntity.status"
                                                         disabled="blade.isLocked"></va-setting-value-select>
                            </div>
                            <div class="form-group">
                                <label class="form-label">{{ 'orders.blades.payment-detail.labels.amount' | translate }}</label>
                                <div class="form-input __currency">
                                    <span class="currency">{{blade.currentEntity.currency}}</span>
                                    <input money mask-money="!blade.isVisiblePrices" required type="text" ng-model="blade.currentEntity.sum">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="form-label">{{ 'orders.blades.payment-detail.labels.vendor' | translate }} <a href="" ng-click="blade.openVendorsManagement()" class="form-edit" va-permission="customer:read"><i class="form-ico fa fa-pencil"></i></a></label>
                                <ui-scroll-drop-down ng-model="blade.currentEntity.vendorId"
                                                     data="blade.fetchVendors(criteria)"
                                                     placeholder="'orders.blades.payment-detail.placeholders.vendor'">
                                </ui-scroll-drop-down>
                            </div>
                        </div>
                        <div class="column">
                            <div class="form-group">
                                <label class="form-label">{{ 'orders.blades.payment-detail.labels.payment-purpose' | translate }}</label>
                                <div class="form-input">
                                    <textarea ng-model="blade.currentEntity.purpose"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </fieldset>
            </form>
            <va-widget-container group="paymentDetailWidgets" blade="blade" gridster-opts="{width: 526}"></va-widget-container>
        </div>
    </div>
</div>


<script type="text/ng-template" id="price.html">
    <div class="form-input __currency">
        <span class="currency">{{blade.currentEntity.currency}}</span>
        <input money mask-money="!blade.isVisiblePrices" required ng-model="blade.currentEntity.price" ng-change="blade.updateRecalculationFlag()">
    </div>
</script>
<script type="text/ng-template" id="priceWithTax.html">
    <div class="form-input __currency">
        <span class="currency">{{blade.currentEntity.currency}}</span>
        <input money mask-money="!blade.isVisiblePrices" required ng-model="blade.currentEntity.priceWithTax" ng-change="blade.updateRecalculationFlag()">
    </div>
</script>

