Commit 8b8c4034 authored by đinh thị đầm's avatar đinh thị đầm

new page

parent 19c5ecee
package com.itsol.quantrivanphong.access.homepage.business;
import com.itsol.quantrivanphong.access.homepage.repository.CatalogiRepository;
import com.itsol.quantrivanphong.exception.ResourceNotFoundException;
import com.itsol.quantrivanphong.model.Catalogi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -23,4 +24,13 @@ public class CatalogiBusiness {
public Catalogi save(Catalogi catalogi){
return catalogiRepository.save(catalogi);
}
public String deleteCatalogi(int catalogiId){
Catalogi catalogi = catalogiRepository.findCatalogiById(catalogiId);
if(catalogi == null){
throw new ResourceNotFoundException("News" ,"newsId",catalogiId);
}
catalogiRepository.delete(catalogi);
return "ok";
}
}
......@@ -30,9 +30,17 @@ public class CatalogiController {
return catalogi;
}
@PostMapping("/catalogi")
@PostMapping("HR/catalogi")
public Catalogi createCatalogi(@Valid@RequestBody Catalogi catalogi) {
return catalogiBusiness.save(catalogi);
}
@DeleteMapping("HR/catalogi/{catalogiId}")
public ResponseEntity<?> deleteNews(@PathVariable (value = "catalogiId") int catalogiId) {
if(catalogiBusiness.findCatalogiById(catalogiId)== null){
throw new ResourceNotFoundException("News","newsId",catalogiId);
}
return ResponseEntity.ok(catalogiBusiness.deleteCatalogi(catalogiId));
}
}
package com.itsol.quantrivanphong.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -31,9 +30,9 @@ public class Catalogi {
private String descriptions;
@JsonIgnore
@OneToMany(mappedBy = "catalogi", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<News> newsList = new ArrayList<>();
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "catalogi")
private List<News> news = new ArrayList<>();
}
package com.itsol.quantrivanphong.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.itsol.quantrivanphong.audit.DateAudit;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
......@@ -14,7 +17,7 @@ import javax.persistence.*;
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners(AuditingEntityListener.class)
@JsonIgnoreProperties(value = {"createdAt", "updatedAt"},allowGetters = true)
@JsonIgnoreProperties(value = {"createdAt", "updatedAt"}, allowGetters = true)
@Table(name = "news")
public class News extends DateAudit {
......@@ -37,16 +40,17 @@ public class News extends DateAudit {
@Column(name = "status")
private boolean status;
// @JsonIgnore
@ManyToOne(fetch = FetchType.EAGER)
// @JoinColumn(name = "catalogid", nullable = false)
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "catalogi_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private Catalogi catalogi;
// @JsonIgnore
@ManyToOne(fetch = FetchType.EAGER)
// @JoinColumn(name = "employeeid", nullable = false)
private Employee employee;
private Employee employee;
}
......@@ -33,6 +33,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.js"></script>
<script src="js/angular-route.js"></script>
<script src="js/angular-ui-router.min.js"></script>
<script src="js/angular-resource.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-animate.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-sanitize.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.3.3.js"></script>
......@@ -45,9 +46,10 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
<script src="pages/issue/IssueAddControlelr.js"></script>
<script src="pages/issue/IssueController.js"></script>
<script src="pages/issue/IssuesDetailController.js"></script>
<script src="pages/issue/IssuesDeleteController.js"></script>>
<script src="pages/issue/IssuesDeleteController.js"></script>
<script src="pages/leaveform/leaveFormController.js"></script>
<script src="pages/homepage/homeController.js"></script>
<script src="pages/homepage/MyHomeController.js"></script>
<script src="pages/homepage/HomeService.js"></script>
<script src="pages/timesheet/timeSheetController.js"></script>
<script src="pages/timesheet/timeSheetDetailController.js"></script>
<script src="pages/leaveform/leaveFormDetailController.js"></script>
......@@ -119,6 +121,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
</script>
</head>
<body class="cbp-spmenu-push" ng-app="myApp">
<div ui-view="layout"></div>
......
/**
* @license AngularJS v1.3.14
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
var $resourceMinErr = angular.$$minErr('$resource');
// Helper functions and regex to lookup a dotted path on an object
// stopping at undefined/null. The path must be composed of ASCII
// identifiers (just like $parse)
var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;
function isValidDottedPath(path) {
return (path != null && path !== '' && path !== 'hasOwnProperty' &&
MEMBER_NAME_REGEX.test('.' + path));
}
function lookupDottedPath(obj, path) {
if (!isValidDottedPath(path)) {
throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path);
}
var keys = path.split('.');
for (var i = 0, ii = keys.length; i < ii && obj !== undefined; i++) {
var key = keys[i];
obj = (obj !== null) ? obj[key] : undefined;
}
return obj;
}
/**
* Create a shallow copy of an object and clear other fields from the destination
*/
function shallowClearAndCopy(src, dst) {
dst = dst || {};
angular.forEach(dst, function(value, key) {
delete dst[key];
});
for (var key in src) {
if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
dst[key] = src[key];
}
}
return dst;
}
/**
* @ngdoc module
* @name ngResource
* @description
*
* # ngResource
*
* The `ngResource` module provides interaction support with RESTful services
* via the $resource service.
*
*
* <div doc-module-components="ngResource"></div>
*
* See {@link ngResource.$resource `$resource`} for usage.
*/
/**
* @ngdoc service
* @name $resource
* @requires $http
*
* @description
* A factory which creates a resource object that lets you interact with
* [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
*
* The returned resource object has action methods which provide high-level behaviors without
* the need to interact with the low level {@link ng.$http $http} service.
*
* Requires the {@link ngResource `ngResource`} module to be installed.
*
* By default, trailing slashes will be stripped from the calculated URLs,
* which can pose problems with server backends that do not expect that
* behavior. This can be disabled by configuring the `$resourceProvider` like
* this:
*
* ```js
app.config(['$resourceProvider', function($resourceProvider) {
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;
}]);
* ```
*
* @param {string} url A parametrized URL template with parameters prefixed by `:` as in
* `/user/:username`. If you are using a URL with a port number (e.g.
* `http://example.com:8080/api`), it will be respected.
*
* If you are using a url with a suffix, just add the suffix, like this:
* `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`
* or even `$resource('http://example.com/resource/:resource_id.:format')`
* If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
* collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
* can escape it with `/\.`.
*
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
* `actions` methods. If any of the parameter value is a function, it will be executed every time
* when a param value needs to be obtained for a request (unless the param was overridden).
*
* Each key value in the parameter object is first bound to url template if present and then any
* excess keys are appended to the url search query after the `?`.
*
* Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
* URL `/path/greet?salutation=Hello`.
*
* If the parameter value is prefixed with `@` then the value for that parameter will be extracted
* from the corresponding property on the `data` object (provided when calling an action method). For
* example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of `someParam`
* will be `data.someProp`.
*
* @param {Object.<Object>=} actions Hash with declaration of custom actions that should extend
* the default set of resource actions. The declaration should be created in the format of {@link
* ng.$http#usage $http.config}:
*
* {action1: {method:?, params:?, isArray:?, headers:?, ...},
* action2: {method:?, params:?, isArray:?, headers:?, ...},
* ...}
*
* Where:
*
* - **`action`** – {string} – The name of action. This name becomes the name of the method on
* your resource object.
* - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`,
* `DELETE`, `JSONP`, etc).
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
* the parameter value is a function, it will be executed every time when a param value needs to
* be obtained for a request (unless the param was overridden).
* - **`url`** – {string} – action specific `url` override. The url templating is supported just
* like for the resource-level urls.
* - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
* see `returns` section.
* - **`transformRequest`** –
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
* transform function or an array of such functions. The transform function takes the http
* request body and headers and returns its transformed (typically serialized) version.
* By default, transformRequest will contain one function that checks if the request data is
* an object and serializes to using `angular.toJson`. To prevent this behavior, set
* `transformRequest` to an empty array: `transformRequest: []`
* - **`transformResponse`** –
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
* transform function or an array of such functions. The transform function takes the http
* response body and headers and returns its transformed (typically deserialized) version.
* By default, transformResponse will contain one function that checks if the response looks like
* a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior, set
* `transformResponse` to an empty array: `transformResponse: []`
* - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
* GET request, otherwise if a cache instance built with
* {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
* caching.
* - **`timeout`** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} that
* should abort the request when resolved.
* - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
* XHR object. See
* [requests with credentials](https://developer.mozilla.org/en/http_access_control#section_5)
* for more information.
* - **`responseType`** - `{string}` - see
* [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
* with `http response` object. See {@link ng.$http $http interceptors}.
*
* @param {Object} options Hash with custom settings that should extend the
* default `$resourceProvider` behavior. The only supported option is
*
* Where:
*
* - **`stripTrailingSlashes`** – {boolean} – If true then the trailing
* slashes from any calculated URL will be stripped. (Defaults to true.)
*
* @returns {Object} A resource "class" object with methods for the default set of resource actions
* optionally extended with custom `actions`. The default set contains these actions:
* ```js
* { 'get': {method:'GET'},
* 'save': {method:'POST'},
* 'query': {method:'GET', isArray:true},
* 'remove': {method:'DELETE'},
* 'delete': {method:'DELETE'} };
* ```
*
* Calling these methods invoke an {@link ng.$http} with the specified http method,
* destination and parameters. When the data is returned from the server then the object is an
* instance of the resource class. The actions `save`, `remove` and `delete` are available on it
* as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
* read, update, delete) on server-side data like this:
* ```js
* var User = $resource('/user/:userId', {userId:'@id'});
* var user = User.get({userId:123}, function() {
* user.abc = true;
* user.$save();
* });
* ```
*
* It is important to realize that invoking a $resource object method immediately returns an
* empty reference (object or array depending on `isArray`). Once the data is returned from the
* server the existing reference is populated with the actual data. This is a useful trick since
* usually the resource is assigned to a model which is then rendered by the view. Having an empty
* object results in no rendering, once the data arrives from the server then the object is
* populated with the data and the view automatically re-renders itself showing the new data. This
* means that in most cases one never has to write a callback function for the action methods.
*
* The action methods on the class object or instance object can be invoked with the following
* parameters:
*
* - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])`
* - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])`
* - non-GET instance actions: `instance.$action([parameters], [success], [error])`
*
*
* Success callback is called with (value, responseHeaders) arguments. Error callback is called
* with (httpResponse) argument.
*
* Class actions return empty instance (with additional properties below).
* Instance actions return promise of the action.
*
* The Resource instances and collection have these additional properties:
*
* - `$promise`: the {@link ng.$q promise} of the original server interaction that created this
* instance or collection.
*
* On success, the promise is resolved with the same resource instance or collection object,
* updated with data from server. This makes it easy to use in
* {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view
* rendering until the resource(s) are loaded.
*
* On failure, the promise is resolved with the {@link ng.$http http response} object, without
* the `resource` property.
*
* If an interceptor object was provided, the promise will instead be resolved with the value
* returned by the interceptor.
*
* - `$resolved`: `true` after first server interaction is completed (either with success or
* rejection), `false` before that. Knowing if the Resource has been resolved is useful in
* data-binding.
*
* @example
*
* # Credit card resource
*
* ```js
// Define CreditCard class
var CreditCard = $resource('/user/:userId/card/:cardId',
{userId:123, cardId:'@id'}, {
charge: {method:'POST', params:{charge:true}}
});
// We can retrieve a collection from the server
var cards = CreditCard.query(function() {
// GET: /user/123/card
// server returns: [ {id:456, number:'1234', name:'Smith'} ];
var card = cards[0];
// each item is an instance of CreditCard
expect(card instanceof CreditCard).toEqual(true);
card.name = "J. Smith";
// non GET methods are mapped onto the instances
card.$save();
// POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}
// server returns: {id:456, number:'1234', name: 'J. Smith'};
// our custom method is mapped as well.
card.$charge({amount:9.99});
// POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
});
// we can create an instance as well
var newCard = new CreditCard({number:'0123'});
newCard.name = "Mike Smith";
newCard.$save();
// POST: /user/123/card {number:'0123', name:'Mike Smith'}
// server returns: {id:789, number:'0123', name: 'Mike Smith'};
expect(newCard.id).toEqual(789);
* ```
*
* The object returned from this function execution is a resource "class" which has "static" method
* for each action in the definition.
*
* Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and
* `headers`.
* When the data is returned from the server then the object is an instance of the resource type and
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
* operations (create, read, update, delete) on server-side data.
```js
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123}, function(user) {
user.abc = true;
user.$save();
});
```
*
* It's worth noting that the success callback for `get`, `query` and other methods gets passed
* in the response that came from the server as well as $http header getter function, so one
* could rewrite the above example and get access to http headers as:
*
```js
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123}, function(u, getResponseHeaders){
u.abc = true;
u.$save(function(u, putResponseHeaders) {
//u => saved user object
//putResponseHeaders => $http header getter
});
});
```
*
* You can also access the raw `$http` promise via the `$promise` property on the object returned
*
```
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123})
.$promise.then(function(user) {
$scope.user = user;
});
```
* # Creating a custom 'PUT' request
* In this example we create a custom method on our resource to make a PUT request
* ```js
* var app = angular.module('app', ['ngResource', 'ngRoute']);
*
* // Some APIs expect a PUT request in the format URL/object/ID
* // Here we are creating an 'update' method
* app.factory('Notes', ['$resource', function($resource) {
* return $resource('/notes/:id', null,
* {
* 'update': { method:'PUT' }
* });
* }]);
*
* // In our controller we get the ID from the URL using ngRoute and $routeParams
* // We pass in $routeParams and our Notes factory along with $scope
* app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',
function($scope, $routeParams, Notes) {
* // First get a note object from the factory
* var note = Notes.get({ id:$routeParams.id });
* $id = note.id;
*
* // Now call update passing in the ID first then the object you are updating
* Notes.update({ id:$id }, note);
*
* // This will PUT /notes/ID with the note object in the request payload
* }]);
* ```
*/
angular.module('ngResource', ['ng']).
provider('$resource', function() {
var provider = this;
this.defaults = {
// Strip slashes by default
stripTrailingSlashes: true,
// Default actions configuration
actions: {
'get': {method: 'GET'},
'save': {method: 'POST'},
'query': {method: 'GET', isArray: true},
'remove': {method: 'DELETE'},
'delete': {method: 'DELETE'}
}
};
this.$get = ['$http', '$q', function($http, $q) {
var noop = angular.noop,
forEach = angular.forEach,
extend = angular.extend,
copy = angular.copy,
isFunction = angular.isFunction;
/**
* We need our custom method because encodeURIComponent is too aggressive and doesn't follow
* http://www.ietf.org/rfc/rfc3986.txt with regards to the character set
* (pchar) allowed in path segments:
* segment = *pchar
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* pct-encoded = "%" HEXDIG HEXDIG
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
* / "*" / "+" / "," / ";" / "="
*/
function encodeUriSegment(val) {
return encodeUriQuery(val, true).
replace(/%26/gi, '&').
replace(/%3D/gi, '=').
replace(/%2B/gi, '+');
}
/**
* This method is intended for encoding *key* or *value* parts of query component. We need a
* custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't
* have to be encoded per http://tools.ietf.org/html/rfc3986:
* query = *( pchar / "/" / "?" )
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* pct-encoded = "%" HEXDIG HEXDIG
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
* / "*" / "+" / "," / ";" / "="
*/
function encodeUriQuery(val, pctEncodeSpaces) {
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
}
function Route(template, defaults) {
this.template = template;
this.defaults = extend({}, provider.defaults, defaults);
this.urlParams = {};
}
Route.prototype = {
setUrlParams: function(config, params, actionUrl) {
var self = this,
url = actionUrl || self.template,
val,
encodedVal;
var urlParams = self.urlParams = {};
forEach(url.split(/\W/), function(param) {
if (param === 'hasOwnProperty') {
throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name.");
}
if (!(new RegExp("^\\d+$").test(param)) && param &&
(new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
urlParams[param] = true;
}
});
url = url.replace(/\\:/g, ':');
params = params || {};
forEach(self.urlParams, function(_, urlParam) {
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
if (angular.isDefined(val) && val !== null) {
encodedVal = encodeUriSegment(val);
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) {
return encodedVal + p1;
});
} else {
url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,
leadingSlashes, tail) {
if (tail.charAt(0) == '/') {
return tail;
} else {
return leadingSlashes + tail;
}
});
}
});
// strip trailing slashes and set the url (unless this behavior is specifically disabled)
if (self.defaults.stripTrailingSlashes) {
url = url.replace(/\/+$/, '') || '/';
}
// then replace collapse `/.` if found in the last URL path segment before the query
// E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
url = url.replace(/\/\.(?=\w+($|\?))/, '.');
// replace escaped `/\.` with `/.`
config.url = url.replace(/\/\\\./, '/.');
// set params - delegate param encoding to $http
forEach(params, function(value, key) {
if (!self.urlParams[key]) {
config.params = config.params || {};
config.params[key] = value;
}
});
}
};
function resourceFactory(url, paramDefaults, actions, options) {
var route = new Route(url, options);
actions = extend({}, provider.defaults.actions, actions);
function extractParams(data, actionParams) {
var ids = {};
actionParams = extend({}, paramDefaults, actionParams);
forEach(actionParams, function(value, key) {
if (isFunction(value)) { value = value(); }
ids[key] = value && value.charAt && value.charAt(0) == '@' ?
lookupDottedPath(data, value.substr(1)) : value;
});
return ids;
}
function defaultResponseInterceptor(response) {
return response.resource;
}
function Resource(value) {
shallowClearAndCopy(value || {}, this);
}
Resource.prototype.toJSON = function() {
var data = extend({}, this);
delete data.$promise;
delete data.$resolved;
return data;
};
forEach(actions, function(action, name) {
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
Resource[name] = function(a1, a2, a3, a4) {
var params = {}, data, success, error;
/* jshint -W086 */ /* (purposefully fall through case statements) */
switch (arguments.length) {
case 4:
error = a4;
success = a3;
//fallthrough
case 3:
case 2:
if (isFunction(a2)) {
if (isFunction(a1)) {
success = a1;
error = a2;
break;
}
success = a2;
error = a3;
//fallthrough
} else {
params = a1;
data = a2;
success = a3;
break;
}
case 1:
if (isFunction(a1)) success = a1;
else if (hasBody) data = a1;
else params = a1;
break;
case 0: break;
default:
throw $resourceMinErr('badargs',
"Expected up to 4 arguments [params, data, success, error], got {0} arguments",
arguments.length);
}
/* jshint +W086 */ /* (purposefully fall through case statements) */
var isInstanceCall = this instanceof Resource;
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
var httpConfig = {};
var responseInterceptor = action.interceptor && action.interceptor.response ||
defaultResponseInterceptor;
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
undefined;
forEach(action, function(value, key) {
if (key != 'params' && key != 'isArray' && key != 'interceptor') {
httpConfig[key] = copy(value);
}
});
if (hasBody) httpConfig.data = data;
route.setUrlParams(httpConfig,
extend({}, extractParams(data, action.params || {}), params),
action.url);
var promise = $http(httpConfig).then(function(response) {
var data = response.data,
promise = value.$promise;
if (data) {
// Need to convert action.isArray to boolean in case it is undefined
// jshint -W018
if (angular.isArray(data) !== (!!action.isArray)) {
throw $resourceMinErr('badcfg',
'Error in resource configuration for action `{0}`. Expected response to ' +
'contain an {1} but got an {2}', name, action.isArray ? 'array' : 'object',
angular.isArray(data) ? 'array' : 'object');
}
// jshint +W018
if (action.isArray) {
value.length = 0;
forEach(data, function(item) {
if (typeof item === "object") {
value.push(new Resource(item));
} else {
// Valid JSON values may be string literals, and these should not be converted
// into objects. These items will not have access to the Resource prototype
// methods, but unfortunately there
value.push(item);
}
});
} else {
shallowClearAndCopy(data, value);
value.$promise = promise;
}
}
value.$resolved = true;
response.resource = value;
return response;
}, function(response) {
value.$resolved = true;
(error || noop)(response);
return $q.reject(response);
});
promise = promise.then(
function(response) {
var value = responseInterceptor(response);
(success || noop)(value, response.headers);
return value;
},
responseErrorInterceptor);
if (!isInstanceCall) {
// we are creating instance / collection
// - set the initial promise
// - return the instance / collection
value.$promise = promise;
value.$resolved = false;
return value;
}
// instance call
return promise;
};
Resource.prototype['$' + name] = function(params, success, error) {
if (isFunction(params)) {
error = success; success = params; params = {};
}
var result = Resource[name].call(this, params, this, success, error);
return result.$promise || result;
};
});
Resource.bind = function(additionalParamDefaults) {
return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
};
return Resource;
}
return resourceFactory;
}];
});
})(window, window.angular);
/**
*
*/
angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
angular.module("myApp", ["ngAnimate","ngResource", "ui.router", "ui.bootstrap"]).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.hashPrefix('');
$urlRouterProvider.otherwise("/employees");
......@@ -107,13 +107,50 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
})
.state("news",{
.state("CatagoriManagement",{
parent:'layout1',
url:"/news",
url:"/management/catagori",
views:{
"content":{
templateUrl:"pages/homepage/catagoriManagements.html",
controller:"homeController"
templateUrl: "pages/homepage/catagoriManagements.html",
controller: "MyHomeController"
}
}
})
.state("newsManagement",{
parent:'layout1',
url:"/management/catagori/:myCatagoriId",
params:{
myCatagoriId : null
},
views:{
"content":{
templateUrl: "pages/homepage/newsManagements.html",
controller: "MyHomeController"
}
}
})
.state("newsEditManagement",{
parent:'layout1',
url:"/management/catagori/:myCatagoriEditId/news/:myNewsEditId",
views:{
"content":{
templateUrl: "pages/homepage/newsEditManagement.html",
controller: "MyHomeController"
}
}
})
.state("newsAddManagement",{
parent:'layout1',
url:"/management/HR/:employeeId/catagori/:myCatagoriAddId/createNews",
views:{
"content":{
templateUrl: "pages/homepage/newsAddManagement.html",
controller: "MyHomeController"
}
}
})
......@@ -195,9 +232,6 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
})
//danh sách các dự án
.state("project", {
parent: 'layout1',
url: "/project",
......@@ -208,7 +242,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//thêm mới dự án
.state("addproject", {
parent: 'layout1',
url: "/addproject",
......@@ -219,7 +253,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//sửa thông tin dự án
.state("editproject", {
parent: 'layout1',
url: "/editproject/:ID",
......@@ -230,7 +264,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//danh sách thành viên trong nhóm dự án
.state("groupProjectByProjectId", {
parent: 'layout1',
url: "/groupProjectByProjectId/:ID",
......@@ -242,7 +276,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//thêm thành viên vào nhóm dự án
.state("addEmployeeProject", {
parent: 'layout1',
url: "/addEmployeeProject",
......@@ -253,7 +287,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//sửa thông tin nhân viên trong nhóm
.state("editEmployeeProject", {
parent: 'layout1',
url: "/editEmployeeProject/:ID",
......@@ -264,7 +298,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
// danh sách project vào các issues
.state("issues", {
parent: 'layout1',
url: "/issues",
......@@ -275,7 +309,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
// thêm mới issues
.state("addIssues", {
parent: 'layout1',
url: "/addIssues",
......@@ -286,7 +320,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
// thêm mới issues
.state("IssuesComment", {
parent: 'layout1',
url: "/issuescomment/:IssuesId",
......
......@@ -50,7 +50,7 @@
<!-- END DUng-->
<li class="treeview">
<li class="treeview">
<a ui-sref="news">
<a ui-sref="CatagoriManagement">
<i class="fa fa-newspaper-o" aria-hidden="true"></i>
<span>News</span>
</a>
......
<div>
<link rel="stylesheet" href="../css/bootstrap-combined.min.css">
<body class="animsition">
<div ui-view="content">
<!-- Header -->
<header>
<!-- Header Mobile -->
<div class="wrap-header-mobile">
<!-- Logo moblie -->
<div class="logo-mobile">
<a href="index.html"><img src="images/logo_1.png" alt="IMG-LOGO"></a>
</div>
<!-- Button show menu -->
<div class="btn-show-menu-mobile hamburger hamburger--squeeze m-r--8">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</div>
</div>
<!-- Menu Mobile -->
<div class="menu-mobile">
<ul class="topbar-mobile">
<li class="right-topbar">
<a href="#">
<span class="fab fa-facebook-f"></span>
</a>
<a href="#">
<span class="fab fa-twitter"></span>
</a>
<a href="#">
<span class="fab fa-pinterest-p"></span>
</a>
<a href="#">
<span class="fab fa-vimeo-v"></span>
</a>
<a href="#">
<span class="fab fa-youtube"></span>
</a>
</li>
</ul>
<ul class="main-menu-m">
<li>
<a href="index.html">Home</a>
</li>
<li>
<a href="category-01.html">Categories</a>
</li>
<li>
<a href="category-02.html">Entertainment </a>
</li>
<li>
<a href="category-01.html">Business</a>
</li>
<li>
<a href="category-02.html">Travel</a>
</li>
<li>
<a href="category-01.html">Life Style</a>
</li>
<li>
<a href="category-02.html">Video</a>
</li>
</ul>
</div>
<!-- -->
<div class="wrap-logo container">
<!-- Logo desktop -->
<div class="logo">
<a href="index.html"><img src="images/logo_1.png" alt="LOGO"></a>
</div>
</div>
<!-- -->
<div class="wrap-main-nav">
<div class="main-nav">
<!-- Menu desktop -->
<nav class="menu-desktop">
<a class="logo-stick" href="index.html">
<img src="images/icons/logo-01.png" alt="LOGO">
</a>
<ul class="main-menu">
<li>
<a href="index.html">Home</a>
</li>
<li class="mega-menu-item category">
<a href="#">Categories</a>
<div class="sub-mega-menu">
<div class="nav flex-column nav-pills" role="tablist">
<div data-ng-repeat="catagori in catagories">
<a ng-click="show(catagori.id)" class="nav-link " data-toggle="pill" href="#{{catagori.id}}" role="tab">{{catagori.name}}</a>
</div>
</div>
<div class="tab-content">
<span data-ng-repeat="catagori in catagories">
<span class="tab-pane" id="{{catagori.id}}" role="tabpanel"></span>
</span>
<div class="row">
<div class="col-3" data-ng-repeat="news in newestNews">
<!-- Item post -->
<div >
<a href="http://localhost:8080/index.html#/news/{{news.id}}" class="wrap-pic-w hov1 trans-03">
<img src="{{news.thumbnail}}" alt="IMG">
</a>
<div class="p-t-10">
<h5 class="p-b-5">
<a href="http://localhost:8080/index.html#/news/{{news.id}}" class="f1-s-5 cl3 hov-cl10 trans-03">
{{news.content}}
</a>
</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
<li>
<a href="index.html">About Us</a>
</li>
<li>
<a href="#">Login</a>
</li>
<li>
<a href="#s">Sign up</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<!-- Headline -->
<div class="container">
<div class="bg0 flex-wr-sb-c p-rl-20 p-tb-8">
<div class="f2-s-1 p-r-30 size-w-0 m-tb-6 flex-wr-s-c">
<span class="text-uppercase cl2 p-r-8">
Welcome :
</span>
<span class="dis-inline-block cl6 slide100-txt pos-relative size-w-0" data-in="fadeInDown" data-out="fadeOutDown">
<span class="dis-inline-block slide100-txt-item animated visible-false">
Have a nice day!
</span>
<span class="dis-inline-block slide100-txt-item animated visible-false">
Discover our page with amazing news!!
</span>
<span class="dis-inline-block slide100-txt-item animated visible-false">
You are awesome!
</span>
</span>
</div>
<div class="pos-relative size-a-2 bo-1-rad-22 of-hidden bocl11 m-tb-6">
<input class="f1-s-1 cl6 plh9 s-full p-l-25 p-r-45" type="text" name="search" placeholder="Search">
<button class="flex-c-c size-a-1 ab-t-r fs-20 cl2 hov-cl10 trans-03">
<i class="zmdi zmdi-search"></i>
</button>
</div>
</div>
</div>
</div>
<!--body-->
<div>
<div ui-view="content"></div>
</div>
<footer>
<div class="bg2 p-t-40 p-b-25">
<div class="container">
<div class="row">
<div class="col-lg-4 p-b-20">
<div class="size-h-3 flex-s-c">
<a href="index.html">
<img class="max-s-full" src="images/icons/logo-02.png" alt="LOGO">
</a>
</div>
<div>
<p class="f1-s-1 cl11 p-b-16">
Thanks for visiting our page!
</p>
<p class="f1-s-1 cl11 p-b-16">
Any questions? Call us on 0968099149
</p>
<div class="p-t-15">
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-facebook-f"></span>
</a>
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-twitter"></span>
</a>
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-pinterest-p"></span>
</a>
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-vimeo-v"></span>
</a>
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-youtube"></span>
</a>
</div>
</div>
</div>
<div class="col-sm-6 col-lg-4 p-b-20">
<div class="size-h-3 flex-s-c">
<h5 class="f1-m-7 cl0">
Popular Posts
</h5>
</div>
<ul>
<li class="flex-wr-sb-s p-b-20">
<a href="#" class="size-w-4 wrap-pic-w hov1 trans-03">
<img src="images/popular-post-01.jpg" alt="IMG">
</a>
<div class="size-w-5">
<h6 class="p-b-5">
<a href="#" class="f1-s-5 cl11 hov-cl10 trans-03">
Donec metus orci, malesuada et lectus vitae
</a>
</h6>
<span class="f1-s-3 cl6">
Feb 17
</span>
</div>
</li>
<li class="flex-wr-sb-s p-b-20">
<a href="#" class="size-w-4 wrap-pic-w hov1 trans-03">
<img src="images/popular-post-02.jpg" alt="IMG">
</a>
<div class="size-w-5">
<h6 class="p-b-5">
<a href="#" class="f1-s-5 cl11 hov-cl10 trans-03">
Lorem ipsum dolor sit amet, consectetur
</a>
</h6>
<span class="f1-s-3 cl6">
Feb 16
</span>
</div>
</li>
<li class="flex-wr-sb-s p-b-20">
<a href="#" class="size-w-4 wrap-pic-w hov1 trans-03">
<img src="images/popular-post-03.jpg" alt="IMG">
</a>
<div class="size-w-5">
<h6 class="p-b-5">
<a href="#" class="f1-s-5 cl11 hov-cl10 trans-03">
Suspendisse dictum enim quis imperdiet auctor
</a>
</h6>
<span class="f1-s-3 cl6">
Feb 15
</span>
</div>
</li>
</ul>
</div>
<div class="col-sm-6 col-lg-4 p-b-20">
<div class="size-h-3 flex-s-c">
<h5 class="f1-m-7 cl0">
Category
</h5>
</div>
<ul class="m-t--12">
<li class="how-bor1 p-rl-5 p-tb-10" data-ng-repeat="catagori in catagories">
<a href="#" class="f1-s-5 cl11 hov-cl10 trans-03 p-tb-8">
{{catagori.name}}
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</footer>
<!-- Back to top -->
<div class="btn-back-to-top" id="myBtn">
<span class="symbol-btn-back-to-top">
<span class="fas fa-angle-up"></span>
</span>
</div>
<!-- Modal Video 01-->
<div class="modal fade" id="modal-video-01" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document" data-dismiss="modal">
<div class="close-mo-video-01 trans-0-4" data-dismiss="modal" aria-label="Close">&times;</div>
<div class="wrap-video-mo-01">
<div class="video-mo-01">
<iframe src="https://www.youtube.com/embed/wJnBTPUQS5A?rel=0" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
<script src="../js/main.js"></script>
<!-- <script src="../js/ui-bootstrap-tpls-0.3.0.min.js"></script>-->
</body>
<div class="container">
<table class="table">
<form>
<div class="form-row">
<div class="col">
<tr>
<td><label>User Name</label></td>
<td>
<input type="text" maxlength="29" ng-model="emp.username"/>
</td>
</tr>
<tr>
<td><label>First Name</label></td>
<td>
<input type="text" maxlength="29" ng-model="emp.firstName"/>
</td>
</tr>
<tr>
<td><label>Last Name</label></td>
<td>
<input type="text" maxlength="29" ng-model="emp.lastName"/>
</td>
</tr>
<tr>
<td><label id="email" for="email">Email</label></td>
<td>
<input class="form-check-label" type="email" maxlength="150" ng-model="emp.emailAddress"/>
</td>
</tr>
<tr>
<td><label>Phone</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="emp.phoneNumber"/>
</td>
</tr>
</div>
<div class="col">
<tr>
<td><label>Education</label></td>
<td>
<input type="text" ng-model="emp.education"/>
</td>
</tr>
<tr>
<td><label>Home town</label></td>
<td><input type="text" ng-model="emp.homeTown"/></td>
</tr>
<tr>
<td><label>Department</label></td>
<td><input type="text" ng-model="emp.department"/></td>
</tr>
<tr>
<td><label>Position</label></td>
<td><input type="text" ng-model="emp.position"/></td>
</tr>
<tr>
</div>
<table class="table">
<form>
<div class="form-row">
<div class="col">
<tr>
<td><label>User Name</label></td>
<td>
<input type="text" maxlength="29" ng-model="emp.username"/>
<span style="color:red" ng-show="myForm.emp.username.$dirty && myForm.emp.username.$invalid">
<span ng-show="myForm.emp.username.$error.required">Username is required.</span>
</span>
</td>
</tr>
<tr>
<td><label>First Name</label></td>
<td>
<input type="text" maxlength="29" ng-model="emp.firstName"/>
</td>
</tr>
<tr>
<td><label>Last Name</label></td>
<td>
<input type="text" maxlength="29" ng-model="emp.lastName"/>
</td>
</tr>
<tr>
<td><label id="email" for="email">Email</label></td>
<td>
<input class="form-check-label" type="email" maxlength="150" ng-model="emp.emailAddress"/>
</td>
</tr>
<tr>
<td><label>Phone</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="emp.phoneNumber"/>
</td>
</tr>
</div>
<div class="col">
<tr>
<td><label>Education</label></td>
<td>
<input type="text" ng-model="emp.education"/>
</td>
</tr>
<tr>
<td><label>Home town</label></td>
<td><input type="text" ng-model="emp.homeTown"/></td>
</tr>
<tr>
<td><label>Department</label></td>
<td><input type="text" ng-model="emp.department"/></td>
</tr>
<tr>
<td><label>Position</label></td>
<td><input type="text" ng-model="emp.position"/></td>
</tr>
<tr>
</div>
</form>
<td></td>
<td>
<input class="btn btn-primary" type="submit" name="submit" value="submit" ng-click="save();"/>
<input class="btn btn-primary" type="submit" name="clear" value="clear" ng-click=" emp = null"/>
</td>
</tr>
</table>
</div>
</form>
<td></td>
<td>
<input class="btn btn-primary" type="submit" name="submit" value="submit" ng-click="save();"/>
<input class="btn btn-primary" type="submit" name="clear" value="clear" ng-click=" emp = null"/>
</td>
</tr>
</table>
</div>
\ No newline at end of file
angular.module("myApp").factory('News', function ($resource) {
return $resource('http://localhost:8080/api/news/:id', {id: '@myNewsId'},{
return $resource('http://localhost:8081/api/news/:id', {id: '@myNewsId'},{
'get': {
method: 'GET',
isArray: false
......@@ -9,11 +9,11 @@ angular.module("myApp").factory('News', function ($resource) {
});
angular.module('myApp').factory('Catagories', function ($resource) {
return $resource('http://localhost:8080/api/catalogies/:id', {id: '@myCatagoriesId'});
return $resource('http://localhost:8081/api/catalogies/:id', {id: '@myCatagoriesId'});
});
angular.module('myApp').factory('LatestNews', function ($resource) {
return $resource('http://localhost:8080/api/catalogi/:id/latestNews', {id: '@CatagoriesId'},{
return $resource('http://localhost:8081/api/catalogi/:id/latestNews', {id: '@CatagoriesId'},{
'get': {
method: 'GET',
isArray: true
......@@ -22,7 +22,7 @@ angular.module('myApp').factory('LatestNews', function ($resource) {
});
angular.module('myApp').factory('NewsByCatagori', function ($resource) {
return $resource('http://localhost:8080/api/catalogi/:id/news', {id: '@catagoriesId'},{
return $resource('http://localhost:8081/api/catalogi/:id/news', {id: '@catagoriesId'},{
'get': {
method: 'GET',
isArray: true
......
angular.module("myApp").controller('MyHomeController', function ($scope,$http, $state,News, $window,$stateParams,Catagories,LatestNews) {
$scope.catagories = Catagories.query();
$scope.currentPage = 1
,$scope.numPerPage = 6
,$scope.maxSize = 5;
$scope.catagoriDetail = Catagories.get({}, {myCatagoriesId: $stateParams.catagoriId}).$promise.then(
function (value) {
$scope.todos = value.news;
$scope.catagori = value;
$scope.numPages = function () {
return Math.ceil($scope.todos.length / $scope.numPerPage);
};
console.log( $scope.todos.length);
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.myNews = $scope.todos.slice(begin, end);
});
},
function (error) {
console.log()
}
);
$scope.newsById = News.get({}, {myNewsId: $stateParams.Id1});
$scope.show = function(id){
$scope.newestNews = LatestNews.get({}, {CatagoriesId: id});
};
$scope.catagoriById = Catagories.get({}, {myCatagoriesId: $stateParams.myCatagoriId});
//Delete News
$scope.deleteNews = function(newsId) {
if (confirm("Delete?")) {
$http({
method: 'DELETE',
url: 'http://localhost:8080/api/HR/news/' + newsId,
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
console.log("delete OK");
$state.reload();
}, function (data, status) {
$state.reload();
});
}
};
//Edit news
$scope.newsEditById = News.get({}, {myNewsId: $stateParams.myNewsEditId});
$scope.editNews = function(newsEditById) {
if(confirm("Update?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/api/HR/news/' + newsEditById.id,
data: angular.toJson(newsEditById),
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
console.log("update OK");
$state.go('newsManagement',{myCatagoriId:$stateParams.myCatagoriEditId});
}, function (data, status) {
console.log(status);
});
}
};
//Add News
$scope.createNews = function(newsAdd) {
if(confirm("Add?")) {
$http({
method: 'POST',
url: 'http://localhost:8081/api/HR/'+ $stateParams.employeeId+'/catalogies/' + $stateParams.myCatagoriAddId+'/news',
data: angular.toJson(newsAdd),
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
console.log("update OK");
$state.go('newsManagement',{myCatagoriId:$stateParams.myCatagoriAddId});
}, function (data, status) {
console.log(status);
});
}
};
});
\ No newline at end of file
angular.module("myApp").controller('homeController', function ($scope,$http, $state,News, $window,$stateParams,Catagories,LatestNews) {
$scope.catagories = Catagories.query();
$scope.currentPage = 1
,$scope.numPerPage = 6
,$scope.maxSize = 5;
$scope.catagoriDetail = Catagories.get({}, {myCatagoriesId: $stateParams.catagoriId}).$promise.then(
function (value) {
$scope.todos = value.news;
$scope.catagori = value;
$scope.numPages = function () {
return Math.ceil($scope.todos.length / $scope.numPerPage);
};
console.log( $scope.todos.length);
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.myNews = $scope.todos.slice(begin, end);
});
},
function (error) {
console.log()
}
);
$scope.newsById = News.get({}, {myNewsId: $stateParams.Id1});
$scope.show = function(id){
$scope.newestNews = LatestNews.get({}, {CatagoriesId: id});
};
$scope.catagoriById = Catagories.get({}, {myCatagoriesId: $stateParams.myCatagoriId});
//Delete News
$scope.deleteNews = function(newsId) {
if (confirm("Delete?")) {
$http({
method: 'DELETE',
url: 'http://localhost:8080/api/HR/news/' + newsId,
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
console.log("delete OK");
$state.reload();
}, function (data, status) {
$state.reload();
});
}
};
//Edit news
$scope.newsEditById = News.get({}, {myNewsId: $stateParams.myNewsEditId});
$scope.editNews = function(newsEditById) {
if(confirm("Update?")) {
$http({
method: 'PUT',
url: 'http://localhost:8080/api/HR/news/' + newsEditById.id,
data: angular.toJson(newsEditById),
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
console.log("update OK");
$state.go('newsManagement',{myCatagoriId:$stateParams.myCatagoriEditId});
}, function (data, status) {
console.log(status);
});
}
};
//Add News
$scope.createNews = function(newsAdd) {
if(confirm("Add?")) {
$http({
method: 'POST',
url: 'http://localhost:8080/api/HR/'+ $stateParams.employeeId+'/catalogies/' + $stateParams.myCatagoriAddId+'/news',
data: angular.toJson(newsAdd),
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
console.log("update OK");
$state.go('newsManagement',{myCatagoriId:$stateParams.myCatagoriAddId});
}, function (data, status) {
console.log(status);
});
}
};
});
\ No newline at end of file
......@@ -12,25 +12,25 @@
<tr>
<div ng-if="catagoriById.name == 'Office'">
<a href="#/management/catagori/4" style="float:left"><< Back </a>
<a href="#/management/catagori/5" style="float:left"><< Back </a>
</div>
<div ng-if="catagoriById.name == 'Outdoor Activiy'">
<div ng-if="catagoriById.name == 'Outdoor Activity'">
<a href="#/management/catagori/1" style="float:left"><< Back </a>
</div>
<div ng-if="catagoriById.name == 'Projects'">
<a href="#/management/catagori/2" style="float:left"><< Back</a>
</div>
<div ng-if="catagoriById.name == 'Recruitments'">
<a href="#/management/catagori/3" style="float:left"><< Back </a>
<a href="#/management/catagori/4" style="float:left"><< Back </a>
</div>
<div ng-if="catagoriById.name == 'Office'">
<a href="#/management/catagori/2" style="float:right">Next >> </a>
</div>
<div ng-if="catagoriById.name == 'Outdoor Activiy'">
<a href="#/management/catagori/3" style="float:right">Next >></a>
<div ng-if="catagoriById.name == 'Outdoor Activity'">
<a href="#/management/catagori/4" style="float:right">Next >></a>
</div>
<div ng-if="catagoriById.name == 'Projects'">
<a href="#/management/catagori/4" style="float:right">Next >></a>
<a href="#/management/catagori/5" style="float:right">Next >></a>
</div>
<div ng-if="catagoriById.name == 'Recruitments'">
<a href="#/management/catagori/1" style="float:right">Next >></a>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment