Skip to content

Commit 7a2face

Browse files
committedAug 14, 2019
pov project
1 parent c936fb2 commit 7a2face

File tree

6 files changed

+198
-115
lines changed

6 files changed

+198
-115
lines changed
 

‎.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": ["wesbos"]
2+
//"extends": ["wesbos"]
33
}

‎public/admin/css/style.css

+11
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,14 @@ svg[class*="fa"] {
7373
.select2-selection--single,
7474
.select2-selection__rendered {
7575
line-height: 35px !important; }
76+
77+
.my-mb-15 {
78+
margin-bottom: 15px; }
79+
80+
.modal {
81+
overflow: visible;
82+
z-index: 111;
83+
margin-top: 40px; }
84+
85+
.primary-color {
86+
color: #00C0EF; }

‎public/admin/js/script.js

+66-31
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ $(function() {
4444
$('form#detail').submit(e => {
4545
e.preventDefault();
4646

47+
if($("#btnAdd").text()=='Cancel'){
48+
changeBtnContext('#btnAdd','1');
49+
return;
50+
}
51+
52+
4753
const inputText = document.querySelectorAll('.text-validate');
4854

4955
inputText.forEach(item => {
@@ -87,45 +93,51 @@ $(function() {
8793
}
8894
});
8995

90-
let currentRowIndex = -1;
91-
92-
const tableProjectDetail = this.querySelector('#table-project-detail');
96+
9397

94-
tableProjectDetail.addEventListener('click', e => {
95-
parentTag = $(e.target).parent();
98+
let currentRowIndex = -1;
9699

97-
console.log(parentTag);
100+
const detail = this.querySelector('#project-detail-body');
98101

99-
if (
100-
parentTag.prop('tagName') == 'TR' &&
101-
!parentTag.hasClass('tr-heading')
102-
) {
103-
const lastRow = `#table-project-detail tr[alt=${currentRowIndex}]`;
104-
console.log(lastRow);
102+
detail.addEventListener('click', e => {
103+
104+
console.log(e.target.tagName);
105+
106+
console.log(e.target.className)
107+
108+
console.log(e)
105109

106-
$(lastRow).removeClass('selected-row');
107110

108-
$(tableProjectDetail);
111+
if(e.target.tagName == 'A'){
112+
if(e.target.rel == 'edit'){
113+
getProjectItemForEdit($(e.target).attr('alt'));
114+
}else if(e.target.rel == 'delete'){
109115

110-
currentRowIndex = $(e.target)
111-
.parent()
112-
.attr('alt');
113-
$(e.target)
114-
.parent()
115-
.addClass('selected-row');
116+
}
116117
}
118+
119+
120+
117121
});
118122

119-
$('#table-project-detail').click(e => {});
123+
120124

121125
$('.select2').select2({
122126
theme: 'classic',
123127
width: 'resolve',
124128
});
125129

126130
/* Add property detail to project */
131+
132+
133+
134+
135+
127136
});
128137

138+
139+
140+
129141
function addProjectDetail() {
130142
const type = document.querySelector('#propertyType');
131143
const code = document.querySelector('#code');
@@ -148,16 +160,28 @@ function addProjectDetail() {
148160
const rowCount = $('#table-project-detail td').closest('tr').length + 1;
149161

150162
const row = `<tr class="detail-row" alt=${rowCount - 1}><td>${rowCount}</td>
151-
<td><div alt='${type.value}'></div>${stType}</td>
152-
<td>${code.value}</td>
153-
<td>${description.value}</td>
154-
<td>${no.value}</td>
155-
<td>${st.value}</td>
156-
<td>${propAttribute}</td>
157-
<td>${cost.value}</td>
158-
<td>${price.value}</td>
159-
<td>${free.value}</td>
160-
<td><div alt='${publish.value}'></div>${stPublish}</td>
163+
<td alt='${type.value}'>${stType}</td>
164+
<td alt='${code.value}'>${code.value}</td>
165+
<td alt='${description.value}'>${description.value}</td>
166+
<td alt='${no.value}'>${no.value}</td>
167+
<td alt='${st.value}'>${st.value}</td>
168+
<td alt='${$('#attribute').val()}'>${propAttribute}</td>
169+
<td alt='${cost.value}'>${cost.value}</td>
170+
<td alt='${price.value}'>${price.value}</td>
171+
<td alt='${free.value}'>${free.value}</td>
172+
<td alt='${
173+
publish.value
174+
}' class='pro-detail-publish'>${stPublish}</td>
175+
<td>
176+
<a alt=${rowCount - 1} rel="edit" href="#" class="btn btn-primary edit">Edit</a>
177+
178+
</td>
179+
<td>
180+
<a alt=${rowCount - 1} rel="delete" href="#" class="btn btn-danger delete">Delete</a>
181+
</td>
182+
183+
184+
161185
`;
162186

163187
$('#project-detail-body').append(row);
@@ -170,3 +194,14 @@ function addProjectDetail() {
170194
$('#tCost').text(tCost);
171195
$('#tPrice').text(tPrice);
172196
}
197+
198+
199+
200+
function getProjectItemForEdit(rowIndex) {
201+
let row = document.querySelector(`.tr[alt="${rowIndex}"]`);
202+
console.log(row);
203+
}
204+
205+
function showPropertyPopup(){
206+
207+
}

‎public/admin/scss/style.scss

+12
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,19 @@ svg[class*="fa"] {
122122
.select2-selection__rendered {
123123

124124
line-height: 35px !important;
125+
}
126+
127+
.my-mb-15 {
128+
margin-bottom: 15px;
129+
}
125130

131+
.modal {
132+
overflow: visible;
126133

134+
z-index: 111;
135+
margin-top: 40px;
136+
}
127137

138+
.primary-color {
139+
color: $primary-color;
128140
}

‎resources/views/admin/master.blade.php

+6
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@
4848
<!-- Font Awesome -->
4949
<link rel="stylesheet" href="{{url('admin/css/all.min.css')}}">
5050

51+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" />
5152
<!-- Additional style -->
5253
<link rel="stylesheet" href="{{url('admin/css/style.css')}}">
5354

55+
56+
5457
<meta name="csrf-token" content="{{ csrf_token() }}">
5558
</head>
5659
<!--
@@ -448,6 +451,9 @@
448451
<!-- Select2 -->
449452
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/js/select2.min.js"></script>
450453

454+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>
455+
456+
451457
<script src="{{url('admin/js/script.js')}}"></script>
452458

453459
</body>

0 commit comments

Comments
 (0)