Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boco-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106_2022_02
boco-frontend
Commits
b9073216
Commit
b9073216
authored
2 years ago
by
Håkon Eilertsen Røskaft
Browse files
Options
Downloads
Patches
Plain Diff
Changed rental message to display correct image
parent
c9fb7a01
No related branches found
Branches containing commit
No related tags found
1 merge request
!143
Rental image chat
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/ChatComponents/RentalMessage.vue
+34
-11
34 additions, 11 deletions
src/components/ChatComponents/RentalMessage.vue
tests/unit/component-tests/ChatComponentsTest/RentalMessage.spec.js
+0
-1
0 additions, 1 deletion
.../component-tests/ChatComponentsTest/RentalMessage.spec.js
with
34 additions
and
12 deletions
src/components/ChatComponents/RentalMessage.vue
+
34
−
11
View file @
b9073216
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<p>
Pris:
{{
price
}}
kr
</p>
<p>
Pris:
{{
price
}}
kr
</p>
</div>
</div>
<div
class=
"img-container"
>
<div
class=
"img-container"
>
<img
class=
"img"
:src=
"im
g
"
alt=
"Produkt Bilde"
/>
<img
class=
"img"
:src=
"im
age
"
alt=
"Produkt Bilde"
/>
</div>
</div>
</div>
</div>
<div>
<div>
...
@@ -19,11 +19,21 @@
...
@@ -19,11 +19,21 @@
</p>
</p>
</div>
</div>
</div>
</div>
<div
class=
"buttons"
v-if=
"(!rent.isAccepted && !rent.deleted && this.rent.renterId != this.userID)"
>
<div
class=
"buttons"
v-if=
"
!rent.isAccepted && !rent.deleted && this.rent.renterId != this.userID
"
>
<button
class=
"button green"
@
click=
"accept"
>
Godta
</button>
<button
class=
"button green"
@
click=
"accept"
>
Godta
</button>
<button
class=
"button red"
@
click=
"reject"
>
Avslå
</button>
<button
class=
"button red"
@
click=
"reject"
>
Avslå
</button>
</div>
</div>
<div
class=
"waiting"
v-if=
"!rent.isAccepted && !rent.deleted && this.rent.renterId == this.userID"
>
<div
class=
"waiting"
v-if=
"
!rent.isAccepted && !rent.deleted && this.rent.renterId == this.userID
"
>
Waiting for owner to accept
Waiting for owner to accept
</div>
</div>
<div
class=
""
v-if=
"rent.isAccepted"
>
<div
class=
""
v-if=
"rent.isAccepted"
>
...
@@ -38,8 +48,8 @@
...
@@ -38,8 +48,8 @@
<
script
>
<
script
>
import
axios
from
"
axios
"
;
import
axios
from
"
axios
"
;
import
{
tokenHeader
}
from
"
@/utils/token-utils
"
;
import
{
tokenHeader
,
parseCurrentUser
}
from
"
@/utils/token-utils
"
;
import
{
parseCurrentUser
}
from
"
@/utils/
token-
util
s
"
;
import
{
getItemPictures
,
}
from
"
@/utils/
api
util
"
;
export
default
{
export
default
{
props
:
{
props
:
{
...
@@ -48,13 +58,15 @@ export default {
...
@@ -48,13 +58,15 @@ export default {
required
:
true
,
required
:
true
,
},
},
},
},
data
()
{
return
{
image
:
"
https://images.unsplash.com/photo-1453728013993-6d66e9c9123a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8dmlld3xlbnwwfHwwfHw%3D&w=1000&q=80
"
,
}
},
computed
:
{
computed
:
{
userID
()
{
userID
()
{
return
parseCurrentUser
().
accountId
;
return
parseCurrentUser
().
accountId
;
},
},
img
()
{
return
"
https://images.unsplash.com/photo-1453728013993-6d66e9c9123a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8dmlld3xlbnwwfHwwfHw%3D&w=1000&q=80
"
;
//this.rent.listing.imageUrl;
},
from
()
{
from
()
{
// take ms and turn into date and return date
// take ms and turn into date and return date
return
new
Date
(
this
.
rent
.
fromTime
).
toLocaleDateString
();
return
new
Date
(
this
.
rent
.
fromTime
).
toLocaleDateString
();
...
@@ -75,9 +87,8 @@ export default {
...
@@ -75,9 +87,8 @@ export default {
return
this
.
rent
.
message
||
"
Ingen Melding
"
;
return
this
.
rent
.
message
||
"
Ingen Melding
"
;
},
},
side
()
{
side
()
{
return
this
.
rent
.
renterId
==
this
.
userID
return
this
.
rent
.
renterId
==
this
.
userID
?
"
flex-end
"
:
"
flex-start
"
;
?
"
flex-end
"
:
"
flex-start
"
;
},
}
},
},
methods
:
{
methods
:
{
async
accept
()
{
async
accept
()
{
...
@@ -93,6 +104,18 @@ export default {
...
@@ -93,6 +104,18 @@ export default {
{
headers
:
tokenHeader
()
}
{
headers
:
tokenHeader
()
}
);
);
},
},
async
getImage
()
{
console
.
log
(
this
.
rent
);
let
images
=
await
getItemPictures
(
this
.
rent
.
listingId
);
console
.
log
(
images
);
if
(
images
.
length
>
0
)
{
this
.
image
=
images
[
0
].
picture
;
}
},
},
async
beforeMount
()
{
await
this
.
getImage
();
},
},
};
};
</
script
>
</
script
>
...
...
This diff is collapsed.
Click to expand it.
tests/unit/component-tests/ChatComponentsTest/RentalMessage.spec.js
+
0
−
1
View file @
b9073216
...
@@ -13,7 +13,6 @@ jest.mock("@/utils/token-utils", () => {
...
@@ -13,7 +13,6 @@ jest.mock("@/utils/token-utils", () => {
};
};
});
});
jest
.
mock
(
"
axios
"
);
jest
.
mock
(
"
axios
"
);
describe
(
"
RentalMessage.vue
"
,
()
=>
{
describe
(
"
RentalMessage.vue
"
,
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment