rename rule to rule clause
This commit is contained in:
@@ -81,13 +81,13 @@ export interface RuleBookResponse {
|
|||||||
'characterId': number;
|
'characterId': number;
|
||||||
'ruleSets': { [key: string]: RuleSetResponse; };
|
'ruleSets': { [key: string]: RuleSetResponse; };
|
||||||
}
|
}
|
||||||
export interface RuleResponse {
|
export interface RuleClauseResponse {
|
||||||
'rate': RuleResponseRateEnum;
|
'rate': RuleClauseResponseRateEnum;
|
||||||
'fromLedgerId'?: string;
|
'fromLedgerId'?: string;
|
||||||
'toLedgerId'?: string;
|
'toLedgerId'?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RuleResponseRateEnum = {
|
export const RuleClauseResponseRateEnum = {
|
||||||
None: 'NONE',
|
None: 'NONE',
|
||||||
Value: 'VALUE',
|
Value: 'VALUE',
|
||||||
JitaBuy: 'JITA_BUY',
|
JitaBuy: 'JITA_BUY',
|
||||||
@@ -95,10 +95,10 @@ export const RuleResponseRateEnum = {
|
|||||||
EveEstimate: 'EVE_ESTIMATE',
|
EveEstimate: 'EVE_ESTIMATE',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type RuleResponseRateEnum = typeof RuleResponseRateEnum[keyof typeof RuleResponseRateEnum];
|
export type RuleClauseResponseRateEnum = typeof RuleClauseResponseRateEnum[keyof typeof RuleClauseResponseRateEnum];
|
||||||
|
|
||||||
export interface RuleSetResponse {
|
export interface RuleSetResponse {
|
||||||
'rules': Array<RuleResponse>;
|
'rules': Array<RuleClauseResponse>;
|
||||||
}
|
}
|
||||||
export interface SetCharacterRuleBookRequest {
|
export interface SetCharacterRuleBookRequest {
|
||||||
'ruleSets': { [key: string]: RuleSetResponse; };
|
'ruleSets': { [key: string]: RuleSetResponse; };
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import {RuleResponse} from "@/generated/mammon";
|
import {RuleClauseResponse} from "@/generated/mammon";
|
||||||
import {computed} from "vue";
|
import {computed} from "vue";
|
||||||
import {isMain, Ledger, LedgerSelect, systemLedger, useLedgersStore} from "@/ledger";
|
import {isMain, Ledger, LedgerSelect, systemLedger, useLedgersStore} from "@/ledger";
|
||||||
import {ratesTypes} from "@/rules/rules.ts";
|
import {ratesTypes} from "@/rules/rules.ts";
|
||||||
|
|
||||||
const rule = defineModel<RuleResponse>();
|
const rule = defineModel<RuleClauseResponse>();
|
||||||
|
|
||||||
const ledgersStore = useLedgersStore();
|
const ledgersStore = useLedgersStore();
|
||||||
const {findById} = ledgersStore;
|
const {findById} = ledgersStore;
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import {RuleResponse, RuleResponseRateEnum, RuleSetResponse} from "@/generated/mammon";
|
import {RuleClauseResponse, RuleClauseResponseRateEnum, RuleSetResponse} from "@/generated/mammon";
|
||||||
import RuleInput from "@/rules/RuleInput.vue";
|
import RuleClauseInput from "@/rules/RuleClauseInput.vue";
|
||||||
import {computed, useTemplateRef} from "vue";
|
import {computed, useTemplateRef} from "vue";
|
||||||
import {Bars4Icon, PlusIcon, TrashIcon} from '@heroicons/vue/24/outline';
|
import {Bars4Icon, PlusIcon, TrashIcon} from '@heroicons/vue/24/outline';
|
||||||
import {useSortable} from "@vueuse/integrations/useSortable";
|
import {useSortable} from "@vueuse/integrations/useSortable";
|
||||||
|
|
||||||
const ruleSet = defineModel<RuleSetResponse>();
|
const ruleSet = defineModel<RuleSetResponse>();
|
||||||
const rules = computed<RuleResponse[]>({
|
const rules = computed<RuleClauseResponse[]>({
|
||||||
get: () => ruleSet.value && ruleSet.value.rules ? ruleSet.value.rules : [],
|
get: () => ruleSet.value && ruleSet.value.rules ? ruleSet.value.rules : [],
|
||||||
set: value => ruleSet.value = {rules: value}
|
set: value => ruleSet.value = {rules: value}
|
||||||
})
|
})
|
||||||
|
|
||||||
const addRule = () => {
|
const addRule = () => {
|
||||||
rules.value = [...rules.value, {rate: RuleResponseRateEnum.None}]
|
rules.value = [...rules.value, {rate: RuleClauseResponseRateEnum.None}]
|
||||||
}
|
}
|
||||||
|
|
||||||
const setRule = (index: number, rule?: RuleResponse) => {
|
const setRule = (index: number, rule?: RuleClauseResponse) => {
|
||||||
if (!rule) {
|
if (!rule) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ useSortable(sortableContainer, rules, { handle: '.sortable-handle'});
|
|||||||
<span class="sortable-handle flex">
|
<span class="sortable-handle flex">
|
||||||
<Bars4Icon class="w-6"/>
|
<Bars4Icon class="w-6"/>
|
||||||
</span>
|
</span>
|
||||||
<RuleInput :modelValue="rule" @update:modelValue="v => setRule(index, v)" />
|
<RuleClauseInput :modelValue="rule" @update:modelValue="v => setRule(index, v)" />
|
||||||
<button class="btn-icon" @click="removeRule(index)"><TrashIcon /></button>
|
<button class="btn-icon" @click="removeRule(index)"><TrashIcon /></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import {ruleBookControllerApi} from "@/mammon";
|
import {ruleBookControllerApi} from "@/mammon";
|
||||||
import {RuleBookResponse, RuleResponseRateEnum, RuleSetResponse} from "@/generated/mammon";
|
import {RuleBookResponse, RuleClauseResponseRateEnum, RuleSetResponse} from "@/generated/mammon";
|
||||||
|
|
||||||
export const activityTypes = {
|
export const activityTypes = {
|
||||||
itemBought: {key: "ITEM_BOUGHT", name: "Item Bought"},
|
itemBought: {key: "ITEM_BOUGHT", name: "Item Bought"},
|
||||||
@@ -20,7 +20,7 @@ export const ratesTypes = {
|
|||||||
EveEstimate: {key: "EVE_ESTIMATE", name: "Eve Estimate"},
|
EveEstimate: {key: "EVE_ESTIMATE", name: "Eve Estimate"},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type Rate = { key: RuleResponseRateEnum, name: string }
|
export type Rate = { key: RuleClauseResponseRateEnum, name: string }
|
||||||
|
|
||||||
export const findByCharacterId = (characterId: number): Promise<RuleBook> => ruleBookControllerApi.findByCharacterId(characterId)
|
export const findByCharacterId = (characterId: number): Promise<RuleBook> => ruleBookControllerApi.findByCharacterId(characterId)
|
||||||
.then(response => response.data)
|
.then(response => response.data)
|
||||||
|
|||||||
Reference in New Issue
Block a user