Skip to content

Commit

Permalink
Merge pull request #2 from Baljit998/main
Browse files Browse the repository at this point in the history
Improved look with CSS
  • Loading branch information
hsrai authored Dec 10, 2023
2 parents 1c23ada + 323b443 commit 5bdddbe
Show file tree
Hide file tree
Showing 13 changed files with 255 additions and 19 deletions.
Empty file.
31 changes: 31 additions & 0 deletions noticeboard/notice_board/doctype/assignto/assignto.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-11-24 16:08:31.361349",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"user"
],
"fields": [
{
"fieldname": "user",
"fieldtype": "Link",
"label": "User",
"options": "User"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-11-24 16:08:31.361349",
"modified_by": "Administrator",
"module": "Notice Board",
"name": "assignto",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
8 changes: 8 additions & 0 deletions noticeboard/notice_board/doctype/assignto/assignto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2023, satinderpal singh and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document

class assignto(Document):
pass
2 changes: 2 additions & 0 deletions noticeboard/notice_board/doctype/notice/notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ frappe.ui.form.on('notice', {

// }
});


14 changes: 12 additions & 2 deletions noticeboard/notice_board/doctype/notice/notice.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,23 @@
{
"fieldname": "title",
"fieldtype": "Data",
"in_filter": 1,
"in_global_search": 1,
"in_list_view": 1,
"in_preview": 1,
"in_standard_filter": 1,
"label": "Subject of the notice",
"reqd": 1,
"unique": 1
},
{
"fieldname": "description",
"fieldtype": "Text Editor",
"in_filter": 1,
"in_global_search": 1,
"in_list_view": 1,
"in_preview": 1,
"in_standard_filter": 1,
"label": "Body of the notice",
"reqd": 1
},
Expand All @@ -53,7 +61,7 @@
"index_web_pages_for_search": 1,
"is_published_field": "published",
"links": [],
"modified": "2023-10-12 16:49:44.032256",
"modified": "2023-11-28 11:28:40.646342",
"modified_by": "Administrator",
"module": "Notice Board",
"name": "notice",
Expand Down Expand Up @@ -85,7 +93,9 @@
}
],
"route": "noticeboard",
"sort_field": "modified",
"search_fields": "title",
"show_name_in_global_search": 1,
"sort_field": "title",
"sort_order": "DESC",
"states": [],
"track_changes": 1,
Expand Down
3 changes: 3 additions & 0 deletions noticeboard/notice_board/doctype/notice/notice.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

class notice(WebsiteGenerator):
pass



32 changes: 32 additions & 0 deletions noticeboard/notice_board/doctype/notice/notice_row.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* notices.css */

.notice-container {
border: 1px solid #ddd;
padding: 10px;
margin-bottom: 20px;
}

.notice-header {
display: flex;
align-items: center;
justify-content: space-between;
}

.notice-content {
margin-top: 10px;
}

.notice-title {
font-size: 24px;
margin-bottom: 5px;
}

.notice-image {
width: 80px;
margin-right: 10px;
}

.notice-meta {
color: #555;
}

88 changes: 71 additions & 17 deletions noticeboard/notice_board/doctype/notice/templates/notice_row.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,80 @@
{% set owner_username = doc.owner %}
{% set owner = frappe.get_doc('User', owner_username) %}

<style>
/* notice_row.css */

.notice-container {
border: 1px solid #3498db;
border-radius: 10px;
padding: 15px;
margin-bottom: 20px;
box-shadow: 0 4px 8px rgba(52, 152, 219, 0.1);
background-color: #fff;
transition: transform 0.3s ease; /* Add a subtle transform on hover */
}


.notice-container:hover {
transform: translateY(-5px); /* Lift the notice on hover */
}

<!-- code to get valuse User table -->
<!--
<div>
{% set users = frappe.get_all('User', fields=['username', 'user_image']) %}
{% for user in users %}
<div>
<img src="{{ user.user_image }}" width="80px">
<p> {{ user.username }}</p>
</div>
{% endfor %}
</div>-->
<div>
<p> {{ owner.username }} <!--{{doc.owner}} -->{{frappe.format_date(doc.creation)}} </p>
.notice-header {
display: flex;
align-items: center;
justify-content: space-between;
}

.notice-content {
margin-top: 15px;
}

.notice-title {
font-size: 26px;
margin-bottom: 10px;
color: #333;
}

.notice-image {
width: 60px;
height: 60px;
margin-right: 15px;
border-radius: 50%;
object-fit: cover; /* Maintain aspect ratio for the image */
}

.notice-meta {
color: #777;
font-size: 14px;
}

<p class="font-weight-bolder" style="font-size:30px;"><img src="{{ owner.user_image }}" width="80px"> <a href="{{ doc.route }}">{{ doc.title or doc.name }}</a></p>
<hr>
/* Style the "Read Notice" button */
.notice-read-button {
background-color: #3498db; /* Change to blue */
color: #fff;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.2s ease, color 0.3s ease; /* Add smooth transitions for color change, transform, and text color */
}

/* Change button color on hover */
.notice-read-button:hover {
background-color: #e74c3c; /* Change to red on hover */
}

</style>

<div class="notice-container">
<div class="notice-header">
<p class="notice-meta">{{ owner.username }} - {{ frappe.format_date(doc.creation) }}</p>
<p class="notice-meta"><a href="{{ doc.route }}" class="notice-read-button">Read Notice</a></p>
</div>
<div class="notice-content">
<p class="notice-title font-weight-bolder"><img src="{{ owner.user_image }}" class="notice-image" alt="{{ owner.username }}"> {{ doc.title or doc.name }}</p>
<hr>
</div>
</div>

{% endblock %}
<!-- this is a sample default list template -->

48 changes: 48 additions & 0 deletions noticeboard/www/notices.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{% extends "templates/web.html" %}

{% block title %}{{ _("About Us") }}{% endblock %}

{% block page_content %}

<!-- Add some basic styling for better presentation -->
<style>
.notices-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}

.notice-card {
width: 30%; /* Adjust the width as needed */
margin-bottom: 20px;
padding: 15px;
border: 1px solid #ccc;
border-radius: 8px;
}
</style>

Agent is {{ name }}
The car is {{ car }}
{{ _("About Us") }}

<div>
We believe that great companies are driven by excellence,
and add value to both its customers and society.
You will find our team embodies these values.
</div>

<div class="notices-container">
{% if notices %}
{% for notice in notices %}
<div class="notice-card">
<p>Notice Title: {{ notice.title }}</p>
<p>Creation Date: {{ frappe.format_date(notice.creation) }}</p>
</div>
{% endfor %}
{% else %}
<p>No notices found.</p>
{% endif %}
</div>

{% endblock %}

2 changes: 2 additions & 0 deletions noticeboard/www/notices.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<!-- alert("agent"); -->
35 changes: 35 additions & 0 deletions noticeboard/www/notices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import frappe

def get_context(context):
# Fetch the agent information
context.name = 'YourAgentName'
context.car = 'YourCarDetails'

# Fetch a specific notice (replace 'holiday' with the actual name of your notice)
notice_doc = frappe.get_doc('notice', 'holiday')
owner = frappe.get_doc('User', notice_doc.owner)

context.doc = {
'owner': owner.username,
'creation': notice_doc.creation,
'title': notice_doc.title,
'user_image': owner.user_image,
'route': notice_doc.route,
}

# Fetch all notices and sort by creation date
notices = frappe.get_all('notice', fields=['owner', 'creation', 'title', 'route'], order_by='creation DESC')
context.notices = []

for notice in notices:
owner = frappe.get_doc('User', notice.owner)
context.notices.append({
'owner': owner.username,
'creation': notice.creation,
'title': notice.title,
'user_image': owner.user_image,
'route': notice.route,
})

return context

7 changes: 7 additions & 0 deletions noticeboard/www/user.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h3>List of Users</h3>
<ol>
{% for user in users %}
<li>{{ user.first_name }} {{ user.get("last_name", "") }}</li>
{% endfor %}
</ol>

4 changes: 4 additions & 0 deletions noticeboard/www/user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import frappe
def get_context(context):
context.users = frappe.get_list("User", fields=["first_name", "last_name"])

0 comments on commit 5bdddbe

Please sign in to comment.