Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"baseUrl": "http://localhost:8080",
"pluginsFile": "tests/e2e/plugins/index.js"
}
}
58 changes: 29 additions & 29 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@ axios.defaults.headers["Cache-Control"] = "no-cache";
axios.defaults.baseURL = "https://api-test.gestionix.com/api/v3";

export default {
async login(context) {
const { data } = await axios({
method: "post",
url: "/users/authentication",
data: {
user: "qa@gestionix.com",
password: "gestionix"
}
});
async login() {
const { data } = await axios({
method: "post",
url: "/users/authentication",
data: {
user: "qa@gestionix.com",
password: "gestionix"
}
});

const { access_token, user_id } = data;
const { access_token } = data;

axios.defaults.headers.common["Authorization"] = `Bearer ${access_token}`;
axios.defaults.headers.common["Authorization"] = `Bearer ${access_token}`;

return true;
},
async getCompanies({ commit, state }) {
console.log("Dispatching action");
return true;
},
async getCompanies({ commit }) {
// console.log("Dispatching action");

const { data } = await axios.get("/users/companies");
const { data } = await axios.get("/users/companies");

commit("setCompanies", data);
commit("setCompanies", data);

return true;
},
async getBranches({ commit, state }, companyId) {
commit('selectCompany', companyId);
const { data } = await axios.get("/branch_offices", {
headers: {
Company: companyId
}
});
commit("setBranches", data);
}
}
return true;
},
async getBranches({ commit }, companyId) {
commit("selectCompany", companyId);
const { data } = await axios.get("/branch_offices", {
headers: {
Company: companyId
}
});
commit("setBranches", data);
}
};
8 changes: 4 additions & 4 deletions src/components/CompanyBranch.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<template>
<div class="item office">
<button
:data-testid="`${branch.branch_id}_button`"
class="select-item"
:class="{'active': isActive}"
:class="{ active: isActive }"
:disabled="!branch.active"
@click="selectBranch"
>
<div class="info">
<p>
<strong>{{branch.name}}</strong>
<strong>{{ branch.name }}</strong>
<span v-if="branch.active" class="on"></span>
<span>{{branch.description}}</span>
<span>{{ branch.description }}</span>
</p>
</div>
</button>
Expand Down Expand Up @@ -42,4 +43,3 @@ export default {
}
};
</script>

6 changes: 5 additions & 1 deletion src/components/CompanyOffices.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<div class="icon offices"></div>
<h4>Oficinas</h4>
</div>
<CompanyBranch v-for="branch in branches" :key="branch.branch_id" :branch="branch"/>
<CompanyBranch
v-for="branch in branches"
:key="branch.branch_id"
:branch="branch"
/>
</div>
</template>
<script>
Expand Down
8 changes: 6 additions & 2 deletions src/components/CompanyShops.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
<div class="icon stores"></div>
<h4>Tiendas</h4>
</div>
<CompanyBranch v-for="branch in branches" :key="branch.branch_id" :branch="branch"/>
<hr>
<CompanyBranch
v-for="branch in branches"
:key="branch.branch_id"
:branch="branch"
/>
<hr />
</div>
</template>
<script>
Expand Down
8 changes: 6 additions & 2 deletions src/components/CompanyWarehouses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
<div class="icon warehouses"></div>
<h4>Almacenes</h4>
</div>
<CompanyBranch v-for="branch in branches" :key="branch.branch_id" :branch="branch"/>
<hr>
<CompanyBranch
v-for="branch in branches"
:key="branch.branch_id"
:branch="branch"
/>
<hr />
</div>
</template>
<script>
Expand Down
8 changes: 4 additions & 4 deletions src/components/GxBranches.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<div class="column branches is-half" :class="{'is-hidden': isHidden}">
<CompanyShops v-if="shops.length > 0" :branches="shops"/>
<CompanyWarehouses v-if="warehouses.length > 0" :branches="warehouses"/>
<CompanyOffices v-if="offices.length > 0" :branches="offices"/>
<div class="column branches is-half">
<CompanyShops v-if="shops.length > 0" :branches="shops" />
<CompanyWarehouses v-if="warehouses.length > 0" :branches="warehouses" />
<CompanyOffices v-if="offices.length > 0" :branches="offices" />
</div>
</template>
<script>
Expand Down
7 changes: 6 additions & 1 deletion src/components/GxCompanies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
<h4>Empresas</h4>
</div>
<div v-if="loading">Loading...</div>
<GxCompany v-else v-for="company in companies" :company="company" :key="company.company_id"/>
<GxCompany
v-else
v-for="company in companies"
:company="company"
:key="company.company_id"
/>
</div>
</template>
<script>
Expand Down
11 changes: 6 additions & 5 deletions src/components/GxCompany.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
<button
:data-testid="`${company.emitter.commercial_name}_button`"
class="select-item"
:class="{'active': isActive}"
:class="{ active: isActive }"
@click="getBranches()"
>
<div class="info">
<p>
<strong>{{ companyDisplayName }}</strong>
<span class="on"></span>
<span v-if="company.emitter.tax_id">RFC: {{ company.emitter.tax_id }}</span>
<strong>{{ companyDisplayName }}</strong> <span class="on"></span>
<span v-if="company.emitter.tax_id"
>RFC: {{ company.emitter.tax_id }}</span
>
<button @click="showButton = !showButton">Show button</button>
<button v-if="isActive && showButton">Botón</button>
<button v-if="isActive && showButton" class="question">Botón</button>
</p>
</div>
</button>
Expand Down
8 changes: 3 additions & 5 deletions src/components/SelectBranch.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<template>
<!-- selecciona sucursal -->
<div class="select-branch">
<div class="outer-20-b">
<a href="#">&lt; Regresar</a>
</div>
<div class="outer-20-b"><a href="#">&lt; Regresar</a></div>
<div class="columns">
<GxCompanies/>
<!-- <GxBranches /> -->
<GxCompanies />
<GxBranches />
</div>
</div>
</template>
Expand Down
Loading