Skip to content

Commit

Permalink
Invoice item add new item changes..
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Mar 7, 2020
1 parent c300dd9 commit b243b3f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion resources/assets/js/components/AkauntingSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
<span slot="infoBlock" class="badge badge-success badge-resize float-right" v-if="new_options[real_model]">{{ new_text }}</span>

<select :name="name" v-model="real_model" class="d-none">
<option v-for="(label, value) in selectOptions" :value="value">{{ label }}</option>
<option v-for="(label, value) in selectOptions" :key="value" :value="value">{{ label }}</option>
</select>
</base-input>
</template>
Expand Down
26 changes: 19 additions & 7 deletions resources/assets/js/components/AkauntingSelectRemote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@

<component v-bind:is="add_new_html" @submit="onSubmit"></component>

<select :name="name" class="d-none" v-model="real_model">
<option v-for="(label, value) in selectOptions" :value="value">{{ label }}</option>
<select :name="name" v-model="real_model" class="d-none">
<option v-for="(label, value) in selectOptions" :key="value" :value="value">{{ label }}</option>
</select>

<span slot="infoBlock" class="badge badge-success badge-resize float-right" v-if="new_options[real_model]">{{ new_text }}</span>
Expand Down Expand Up @@ -370,8 +370,8 @@
:key="option.id"
:label="option.name"
:value="option.id">
<span class="float-left">{{ label }}</span>
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span
<span class="float-left">{{ option.name }}</span>
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[option.id]">{{ new_text }}</span>
</el-option>

<el-option-group
Expand Down Expand Up @@ -669,12 +669,16 @@ export default {
})
.then(response => {
if (response.data.success) {
this.selectOptions[response.data.data.id] = response.data.data['name'];
this.new_options[response.data.data.id] = response.data.data['name'];
this.real_model = response.data.data.id;
/*
this.selectOptions = [];
this.selectOptions.push(response.data.data);
this.new_options[response.data.data.id] = response.data.data.id;
this.real_model = response.data.data.id;
*/
this.change();
if (this.title) {
Expand Down Expand Up @@ -788,7 +792,7 @@ export default {
if (response.data.success) {
this.selectOptions[response.data.data.id] = response.data.data['name'];
this.new_options[response.data.data.id] = response.data.data['name'];
this.real_model = response.data.data.id.toString();
this.real_model = response.data.data.id;
this.change();
Expand Down Expand Up @@ -821,7 +825,15 @@ export default {
watch: {
options: function (options) {
// update options
//this.selectOptions = options;
this.selectOptions = options;
if (Object.keys(this.new_options).length) {
for (let [key, value] of Object.entries(this.new_options)) {
if (!this.selectOptions[key]) {
this.selectOptions[key] = value;
}
}
}
},
value: function (value) {
Expand Down
1 change: 1 addition & 0 deletions resources/views/sales/invoices/item.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class="btn btn-icon btn-outline-danger btn-lg">
'path' => route('modals.items.store'),
'type' => 'inline',
'field' => 'name',
'new_text' => trans('modules.new'),
])}}"
@interface="row.item_id = $event"
@label="row.name = $event"
Expand Down

0 comments on commit b243b3f

Please sign in to comment.