@@ -0,0 +1,48 @@
package com.bootcamp.pos.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bootcamp.pos.dao.MstOutletDao;
import com.bootcamp.pos.model.MstOutletModel;
import com.bootcamp.pos.service.MstOutletService;

@Service
@Transactional
public class MstOutletServiceImpl implements MstOutletService {

@Autowired private MstOutletDao dao;

@Override
public List<MstOutletModel> get() throws Exception {
return this.dao.get();
}

@Override
public List<MstOutletModel> search(String keySearch) throws Exception {
return this.dao.search(keySearch);
}

@Override
public MstOutletModel getById(int id) throws Exception {
return this.dao.getById(id);
}

@Override
public void insert(MstOutletModel model) throws Exception {
this.dao.insert(model);
}

@Override
public void update(MstOutletModel model) throws Exception {
this.dao.update(model);
}

@Override
public void delete(MstOutletModel model) throws Exception {
this.dao.delete(model);
}

}
@@ -42,6 +42,7 @@
<value>com.bootcamp.pos.model.MstUserModel</value>
<value>com.bootcamp.pos.model.MstRoleModel</value>
<value>com.bootcamp.pos.model.MstEmployeeModel</value>
<value>com.bootcamp.pos.model.MstOutletModel</value>
<!--<value>com.bootcamp.pos.model.MstCategoryModel</value>
<value>com.bootcamp.pos.model.MstItemModel</value> -->
</list>
@@ -1,4 +1,7 @@
<% request.setAttribute("contextName", request.getContextPath()); %>

<%
request.setAttribute("contextName", request.getContextPath());
%>
<!-- modal -->
<div id="modal-form" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
@@ -9,8 +12,23 @@
</button>
<h4 id="modal-title">Form Kategori</h4>
</div>
<div class="modal-body"></div>
</div>
</div>
</div>

<div id="modal-variant" class="modal modal-primary" tabindex="-1"
role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 id="modal-title" class="modal-title">Assign Outlet</h4>
</div>
<div class="modal-body">

</div>
</div>
</div>
@@ -22,110 +40,186 @@
<h3 class="box-title">Employee List</h3>
<div class="box-tools">
<div class="input-group input-group-sm" style="width: 250px;">
<input type="text" id="txt-search" class="form-control pull-right" placeholder="Search">
<input type="text" id="txt-search" class="form-control pull-right"
placeholder="Search">

<div class="input-group-btn">
<button type="button" id="btn-search" class="btn btn-default"><i class="fa fa-search"></i></button>
<button type="button" id="btn-add" class="btn btn-primary"><i class="fa fa-plus"></i></button>
</div>
</div>
<div class="input-group-btn">
<button type="button" id="btn-search" class="btn btn-default">
<i class="fa fa-search"></i>
</button>
<button type="button" id="btn-add" class="btn btn-primary">
<i class="fa fa-plus"></i>
</button>
</div>
</div>
</div>
</div>
<div class="box-body">
<table class="table table-responsive table-striped">
<!-- <button id="SH">Hide/Show</button> -->
<table id="listEmployee" class="table table-responsive table-striped">
<thead>
<tr>
<td>Name</td>
<td>Email</td>
<td>Have Account</td>
<td>Active</td>
<td>Role</td>
<td>Action</td>
</tr>
</thead>
<tbody id="list-data">

</tbody>
</table>
</div>
</div>

<script>
function loadData(){
/* $('#SH').on('click', function() {
var $rowsNo = $('#listEmployee tbody tr').filter(function() {
return $.trim($(this).find('td').eq(3).text()) === "0"
}).toggle();
});
*/
function loadData() {
$.ajax({
url:'${contextName}/master/employee/list',
dataType:'html',
type:'get',
success:function(result){
url : '${contextName}/master/employee/list',
dataType : 'html',
type : 'get',
success : function(result) {
$("#list-data").html(result);
}
});
}
$(document).ready(function(){
$(document).ready(function() {
// panggil method load data
loadData();
$("#btn-add").click(function(){
$("#btn-add").click(function() {
$.ajax({
url:'${contextName}/master/employee/add',
dataType:'html',
type:'get',
success:function(result){
url : '${contextName}/master/employee/add',
dataType : 'html',
type : 'get',
success : function(result) {
$("#modal-form").find(".modal-body").html(result);
$("#modal-title").html("Add Employee");
$("#modal-form").modal("show");
}
});
});
// modal Outlet
$("#modal-form").on("click","#btn-add-variant",function(){
$.ajax({
url : '${contextName}/master/employee/addOutlet',
dataType : 'html',
type : 'get',
success : function(result) {
$("#modal-variant").find(".modal-body").html(result);
$("#form-variant").trigger("reset");
$("#var-action").val("insert");
$("#modal-variant").modal("show");
}
});
});
// add variant
$("#modal-variant").on("click","#btn-add-outlet",function(){
/*
var outletId =$("#outletId").val();
var action = $("#var-action").val();
if(action=="insert"){
// mencari jumlah variant
var row = $("#modal-form").find("#list-variant >tr").length;
// mendefinisikan row dan column yang akan ditambahkan ke table
var data = '<tr id="'+ row +'">'+
'<td><input type="text" id="outletList_'+ row +'_outletId" name="outletList['+ row +'].outletId" value="'+ outletId +'" class="form-control outletId" /></td>' +
'<td class="class="col-md-1">'+
'<button type="button" class="btn btn-success btn-xs btn-edit-variant"><i class="fa fa-edit"></i> </button> '+
'<button type="button" class="btn btn-danger btn-xs btn-delete-variant"><i class="fa fa-trash-o"></i> </button> '+
'</td>' +
'</tr>';
// tambahkan data ke table
$("#modal-form").find("#list-variant").append(data);
}else {
var id = $("#id").val();
$("#modal-form").find("#outletList_"+ id +"_outletId").val(outletId);
}
*/
// hide modal varian
$("#modal-variant").modal("hide");
});
// saat haveAccount di checked
$("#modal-form").on("change","#haveAccount", function(){
if(this.checked==true){
$("#modal-form").on("change", "#haveAccount", function() {
if (this.checked == true) {
$(this).attr('value', '1');
$("#modal-form").find("#role-account").show();
}else {
} else {
$(this).attr('value', '0');
$("#modal-form").find("#role-account").hide();
}
}
});
// edit data
$("#list-data").on("click",".btn-edit", function(){
$("#list-data").on("click", ".btn-edit", function() {
var vId = $(this).val();
$.ajax({
url:'${contextName}/master/employee/edit',
data:{ id:vId },
dataType:'html',
type:'get',
success:function(result){
url : '${contextName}/master/employee/edit',
data : {
id : vId
},
dataType : 'html',
type : 'get',
success : function(result) {
$("#modal-form").find(".modal-body").html(result);
$("#modal-title").html("Edit Employee");
$("#modal-form").modal("show");
}
});
});
//delete
$("#list-data").on('click', '.btn-delete', function() {
var id = $(this).val();
$.ajax({
url : '${contextName}/master/employee/delete',
data : {
'id' : id
},
type : 'get',
dataType : 'html',
success : function(result) {
$("#modal-form").find(".modal-body").html(result);
$("#modal-title").html("Menghapus Data Employee");
$("#modal-form").addClass("modal-danger");
$("#modal-form").modal("show");
}
});
});
// save, edit, delete
$("#modal-form").on("submit","#form-employee", function(){
$("#modal-form").on("submit", "#form-employee", function() {
var vData = $(this).serialize();
$.ajax({
url:'${contextName}/master/employee/save.json',
type:'post',
data:vData,
success:function(result){
if(result.message=="success"){
url : '${contextName}/master/employee/save.json',
type : 'post',
data : vData,
success : function(result) {
if (result.message == "success") {
$("#modal-form").modal("hide");
loadData();
}
}
});
});
return false;
});
});
</script>
@@ -23,8 +23,12 @@
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label" for="title">Title</label> <input
type="text" name="title" id="title" class="form-control" />
<label class="control-label" for="title">Title</label> <select
name="title" id="title" class="form-control">
<option>Mr.</option>
<option>Mrs.</option>

</select>
</div>
</div>

@@ -37,6 +41,30 @@

</div>

<div class="box box-info">
<div class="box-header">
<h3 class="box-title">Assign Outlet</h3>
<div class="box-tools">
<button type="button" id="btn-add-variant"
class="btn btn-primary btn-sm">
<i class="fa fa-plus"></i>
</button>
</div>
</div>
<div class="box-body">
<table class="table table-considered">
<thead>
<tr>
<td class="col-md-4">Outlet</td>
<td class="col-md-1">Action</td>
</tr>
</thead>
<tbody id="list-variant">

</tbody>
</table>
</div>
</div>

<div class="row">
<div class="form-group col-md-10">
@@ -0,0 +1,29 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<form id="form-variant" class="form-horizontal">
<input type="hidden" id="var-action" name="var-action" value="insert">
<input type="hidden" id="id" name="id">


<div class="form-group">
<label class="control-label col-md-3" for="roleId">Select Role</label>
<div class="col-md-9">
<select id="outletId" name="outletId" class="form-control">
<option value="0">none</option>
<c:forEach var="outlet" items="${outletList}">
<option value="${outlet.id}">${outlet.name}</option>
</c:forEach>
</select>
</div>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-default pull-left"
data-dismiss="modal">
<i class="fa fa-close"></i> Close
</button>
<button type="button" id="btn-add-outlet" class="btn btn-primary">
<i class="fa fa-plus"></i> Add
</button>
</div>
</form>
@@ -26,9 +26,13 @@
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label" for="title">Title</label> <input
type="text" name="title" id="title" value="${item.title }"
class="form-control" />
<input type="hidden" id="getTitle" name="getTitle"
value="${item.title }"> <label class="control-label"
for="title">Title</label> <select name="title" id="title"
class="form-control">
<option>Mr.</option>
<option>Mrs.</option>
</select>
</div>
</div>

@@ -45,8 +49,8 @@
<div class="form-group col-md-10">
<div class="Account">
<input type="hidden" id="haveAccount" name="haveAccount"
value="${item.haveAccount }"> <input type="hidden"
id="RID" name="RID" value="${item.user.roleId }">
value="${item.haveAccount }"> <input type="hidden" id="RID"
name="RID" value="${item.user.roleId }">
</div>
</div>
</div>
@@ -56,7 +60,7 @@
<div class="form-group">
<label class="control-label" for="roleId">Role</label> <select
id="roleId" name="roleId" class="form-control">
<option value="">none</option>
<option value="0">none</option>
<c:forEach var="role" items="${roleList}">
<option value="${role.id}">${role.name}</option>
</c:forEach>
@@ -105,4 +109,7 @@
var role = $('#RID').val();
$("#roleId").val(role);
var title = $('#getTitle').val();
$("#title").val(title);
</script>
@@ -1,9 +1,10 @@
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:forEach var="item" items="${list}">
<tr>
<tr <c:if test="${item.active == 0}">style="display: none"</c:if>>
<td>${item.firstName}</td>
<td>${item.email}</td>
<td class="HA">${item.haveAccount}</td>
<td>${item.active}</td>
<td>${item.user.role.name}</td>

<td>
@@ -21,9 +22,10 @@
$('.HA').filter(function() {
return $.trim(this.innerHTML) === "1"
}).html('<span class="glyphicon glyphicon-ok"></span>');
$('.HA').filter(function() {
return $.trim(this.innerHTML) === "0"
}).html('<span class="glyphicon glyphicon-remove"></span>');
</script>
</c:forEach>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
Built-By: PC
Built-By: XSIS-NB0035
Build-Jdk: 1.8.0_131
Created-By: Maven Integration for Eclipse

@@ -1,7 +1,7 @@
#Generated by Maven Integration for Eclipse
#Tue May 30 01:09:53 ICT 2017
#Tue May 30 15:05:51 ICT 2017
version=1.0.0-BUILD-SNAPSHOT
groupId=com.bootcamp
m2e.projectName=MiniProjectPOS
m2e.projectLocation=D\:\\java\\MiniProjectWorkspace\\MiniProjectPOS
m2e.projectName=BootcampPOS
m2e.projectLocation=D\:\\RA\\Remote\\BootcampPOS
artifactId=pos