<commit_before><?php

use hipanel\modules\stock\widgets\combo\DestinationCombo;
use hipanel\modules\stock\widgets\combo\PartnoCombo;
use hipanel\modules\stock\widgets\combo\SourceCombo;
use hipanel\widgets\AmountWithCurrencyWidget;
use hipanel\widgets\Box;
use hipanel\widgets\DynamicFormWidget;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
use yii\helpers\Url;

?>
<?php $form = ActiveForm::begin([
    'id' => 'dynamic-form',
    'enableClientValidation' => true,
    'validateOnBlur' => true,
    'enableAjaxValidation' => true,
    'validationUrl' => Url::toRoute(['validate-form', 'scenario' => reset($models)->isNewRecord ? 'create' : 'update']),
]) ?>
<?php DynamicFormWidget::begin([
    'widgetContainer' => 'dynamicform_wrapper', // required: only alphanumeric characters plus "_" [A-Za-z0-9_]
    'widgetBody' => '.container-items', // required: css class selector
    'widgetItem' => '.item', // required: css class
    'limit' => 99, // the maximum times, an element can be cloned (default 999)
    'min' => 1, // 0 or 1 (default 1)
    'insertButton' => '.add-item', // css class
    'deleteButton' => '.remove-item', // css class
    'model' => reset($models),
    'formId' => 'dynamic-form',
    'formFields' => [
        'partno',
        'src_id',
        'dst_id',
        'serials',
        'move_type',
        'supplier',
        'order_no',
        'order_no',
        'descr',
        'price',
        'currency',
    ],
]) ?>
<div class="container-items"><!-- widgetContainer -->
    <?php foreach ($models as $i => $model) : ?>
        <?php
        // necessary for update action.
        if ($model->scenario == 'update') {
            $model->setScenario('update');
            echo Html::activeHiddenInput($model, "[$i]id");
        }
        ?>
        <div class="item">
            <?php Box::begin() ?>
            <div class="row input-row margin-bottom">
                <div class="col-lg-offset-10 col-sm-2 text-right">
                    <?php if ($model->isNewRecord) : ?>
                        <div class="btn-group">
                            <button type="button" class="add-item btn btn-default btn-sm"><i class="glyphicon glyphicon-plus"></i></button>
                            <button type="button" class="remove-item btn btn-default btn-sm"><i class="glyphicon glyphicon-minus"></i></button>
                        </div>
                        <!-- /.btn-group -->
                    <?php endif; ?>
                </div>
                <?php if ($model->isNewRecord) : ?>
                    <div class="col-md-6">
                        <?= $form->field($model, "[$i]partno")->widget(PartnoCombo::class) ?>
                        <?= $form->field($model, "[$i]src_id")->widget(SourceCombo::class) ?>
                        <?= $form->field($model, "[$i]dst_id")->widget(DestinationCombo::class) ?>
                    </div>
                    <!-- /.col-md-6 -->
                    <div class="col-md-6">
                        <?= $form->field($model, "[$i]serials") ?>
                        <div class="row">
                            <div class="col-md-4">
                                <?= $form->field($model, "[$i]move_type")->dropDownList($moveTypes) ?>
                            </div>
                            <!-- /.col-md-4 -->
                            <div class="col-md-4">
                                <?= $form->field($model, "[$i]supplier")->dropDownList($suppliers) ?>
                            </div>
                            <!-- /.col-md-4 -->
                            <div class="col-md-4">
                                <?= $form->field($model, "[$i]order_no") ?>
                            </div>
                            <!-- /.col-md-4 -->
                        </div>
                        <!-- /.row -->
                        <div class="row">
                            <div class="col-md-8">
                                <?= $form->field($model, "[$i]move_descr") ?>
                            </div>
                            <!-- /.col-md-8 -->
                            <div class="col-md-2">
                                <?= $form->field($model, "[$i]price") ?>
                            </div>
                            <!-- /.col-md-2 -->
                            <div class="col-md-2">
                                <?= $form->field($model, "[$i]currency")->dropDownList($model->transformToSymbols(array_keys($currencyTypes))) ?>
                            </div>
                            <!-- /.col-md-2 -->
                        </div>
                        <!-- /.row -->
                    </div>
                    <!-- /.col-md-6 -->
                <?php else : ?>
                    <div class="col-md-4">
                        <?= $form->field($model, "[$i]partno")->textInput(['readonly' => true]) ?>
                    </div>
                    <!-- /.col-md-4 -->
                    <div class="col-md-4">
                        <?= $form->field($model, "[$i]serial") ?>
                    </div>
                    <!-- /.col-md-4 -->
                    <div class="col-md-4">
                        <?= $form->field($model, "[$i]price")->widget(AmountWithCurrencyWidget::class, [
                            'inputOptions' => ['placeholder' => '0.00'],
                            'selectAttribute' => "[$i]currency",
                            'selectAttributeOptions' => [
                                'items' => $this->context->getCurrencyTypes(),
                            ],
                        ]) ?>
                    </div>
                    <!-- /.col-md-4 -->
                <?php endif; ?>
            </div>
            <!-- /.row input-row margin-bottom -->
            <?php Box::end() ?>
        </div>
        <!-- /.item --><commit_msg>Add AmountWithCurrencyWidget to create Part<commit_after><?php

use hipanel\modules\stock\widgets\combo\DestinationCombo;
use hipanel\modules\stock\widgets\combo\PartnoCombo;
use hipanel\modules\stock\widgets\combo\SourceCombo;
use hipanel\widgets\AmountWithCurrencyWidget;
use hipanel\widgets\Box;
use hipanel\widgets\DynamicFormWidget;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
use yii\helpers\Url;

?>
<?php $form = ActiveForm::begin([
    'id' => 'dynamic-form',
    'enableClientValidation' => true,
    'validateOnBlur' => true,
    'enableAjaxValidation' => true,
    'validationUrl' => Url::toRoute(['validate-form', 'scenario' => reset($models)->isNewRecord ? 'create' : 'update']),
]) ?>
<?php DynamicFormWidget::begin([
    'widgetContainer' => 'dynamicform_wrapper', // required: only alphanumeric characters plus "_" [A-Za-z0-9_]
    'widgetBody' => '.container-items', // required: css class selector
    'widgetItem' => '.item', // required: css class
    'limit' => 99, // the maximum times, an element can be cloned (default 999)
    'min' => 1, // 0 or 1 (default 1)
    'insertButton' => '.add-item', // css class
    'deleteButton' => '.remove-item', // css class
    'model' => reset($models),
    'formId' => 'dynamic-form',
    'formFields' => [
        'partno',
        'src_id',
        'dst_id',
        'serials',
        'move_type',
        'supplier',
        'order_no',
        'order_no',
        'descr',
        'price',
        'currency',
    ],
]) ?>
<div class="container-items"><!-- widgetContainer -->
    <?php foreach ($models as $i => $model) : ?>
        <?php
        // necessary for update action.
        if ($model->scenario == 'update') {
            $model->setScenario('update');
            echo Html::activeHiddenInput($model, "[$i]id");
        }
        ?>
        <div class="item">
            <?php Box::begin() ?>
            <div class="row input-row margin-bottom">
                <div class="col-lg-offset-10 col-sm-2 text-right">
                    <?php if ($model->isNewRecord) : ?>
                        <div class="btn-group">
                            <button type="button" class="add-item btn btn-default btn-sm"><i class="glyphicon glyphicon-plus"></i></button>
                            <button type="button" class="remove-item btn btn-default btn-sm"><i class="glyphicon glyphicon-minus"></i></button>
                        </div>
                        <!-- /.btn-group -->
                    <?php endif; ?>
                </div>
                <?php if ($model->isNewRecord) : ?>
                    <div class="col-md-6">
                        <?= $form->field($model, "[$i]partno")->widget(PartnoCombo::class) ?>
                        <?= $form->field($model, "[$i]src_id")->widget(SourceCombo::class) ?>
                        <?= $form->field($model, "[$i]dst_id")->widget(DestinationCombo::class) ?>
                    </div>
                    <!-- /.col-md-6 -->
                    <div class="col-md-6">
                        <?= $form->field($model, "[$i]serials") ?>
                        <div class="row">
                            <div class="col-md-4">
                                <?= $form->field($model, "[$i]move_type")->dropDownList($moveTypes) ?>
                            </div>
                            <!-- /.col-md-4 -->
                            <div class="col-md-4">
                                <?= $form->field($model, "[$i]supplier")->dropDownList($suppliers) ?>
                            </div>
                            <!-- /.col-md-4 -->
                            <div class="col-md-4">
                                <?= $form->field($model, "[$i]order_no") ?>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-6">
                                <?= $form->field($model, "[$i]move_descr") ?>
                            </div>
                            <div class="col-md-6">
                                <?= $form->field($model, "[$i]price")->widget(AmountWithCurrencyWidget::class, [
                                    'inputOptions' => ['placeholder' => '0.00'],
                                    'selectAttribute' => "[$i]currency",
                                    'selectAttributeOptions' => [
                                        'items' => $this->context->getCurrencyTypes(),
                                    ],
                                ]) ?>
                            </div>
                        </div>
                        <!-- /.row -->
                    </div>
                    <!-- /.col-md-6 -->
                <?php else : ?>
                    <div class="col-md-4">
                        <?= $form->field($model, "[$i]partno")->textInput(['readonly' => true]) ?>
                    </div>
                    <!-- /.col-md-4 -->
                    <div class="col-md-4">
                        <?= $form->field($model, "[$i]serial") ?>
                    </div>
                    <!-- /.col-md-4 -->
                    <div class="col-md-4">
                        <?= $form->field($model, "[$i]price")->widget(AmountWithCurrencyWidget::class, [
                            'inputOptions' => ['placeholder' => '0.00'],
                            'selectAttribute' => "[$i]currency",
                            'selectAttributeOptions' => [
                                'items' => $this->context->getCurrencyTypes(),
                            ],
                        ]) ?>
                    </div>
                    <!-- /.col-md-4 -->
                <?php endif; ?>
            </div>
            <!-- /.row input-row margin-bottom -->
            <?php Box::end() ?>
        </div>
        <!-- /.item -->
{'fraction_non_alphanumeric': 0.17963357477631017, 'fraction_numerical': 0.006476352790796762, 'mean_word_length': 1.2060150375939849, 'pattern_counts': {'":': 0, '<': 165, '<?xml version=': 0, '>': 274, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2817229', 'n_tokens_mistral': 3252, 'n_tokens_neox': 3149, 'n_words': 524}